-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search UI #627
Search UI #627
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Search in english doesn't seem to be working, for example:
The bottom article comes up when searching for test
But when searching for its title it doesn't show up:
This is with language set to english, the article also comes up if i search for it's swedish title
Also if I press backspace while the input is empty the spinner appears until I type something
But looks great overall, feels very nice to use. Big improvement compared to before!
I found the issue for this. The
So either the @danieladugyan Do you have any thoughts about this? |
I found that this can simply be fixed if the E.g. I don't like the look of this: let url;
if (event.locals.language === "sv") {
url = new URL("/api/search", event.request.url);
} else {
url = new URL("/en/api/search", event.request.url);
} |
Sorry, that's my bad for introducing the bug. Anyways, that's exactly how I think it should work. It's consistent with how language is handled everywhere else in the app.
In summary, if we're on the Swedish site, fetch normally, otherwise fetch with |
I think it's weird though, specifics sent to an API endpoint should IMO be in the query parameters, not extracted from the URL. But I guess this works. Just pushed some changes that fixes the english search and also handle translation mapping.
So we would write a wrapper for the already existing |
I think that solution looks fine since, as Daniel says, that's how language is handled everywhere else. |
Didn't know that was a thing, but that's a nice way to handle it I guess! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comments, looks good otherwise.
Great job!
src/routes/(app)/search/+page.svelte
Outdated
{/if} | ||
{#if form?.message} | ||
<div class="alert alert-error mt-4"> | ||
Error: {JSON.stringify(form)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
form.message looks nicer?
This PR rewrites search in frontend so that it uses the Meilisearch endpoint introduced in #611
It also adds a "advanced search" that allows filtering search on different indexes
It also fixes some minor TS misses that slipped through in the #611 PR
To try out this PR, please ensure that Meilisearch is up and running on your Docker (rerun the
dev/setup_db.sh
script) and then head tolocalhost:.../admin/debug
and pressSync with Meilisearch