Skip to content
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

feat: add autocomplete in search bar #165

Merged
merged 16 commits into from
Jun 20, 2024
Merged

feat: add autocomplete in search bar #165

merged 16 commits into from
Jun 20, 2024

Conversation

Kout95
Copy link
Collaborator

@Kout95 Kout95 commented Jun 14, 2024

What

  • Add terms suggestions on search bar

Screenshots

image

Part of

@Kout95 Kout95 force-pushed the 154-filter-suggestions branch 2 times, most recently from a9636c3 to a004023 Compare June 18, 2024 08:11
@Kout95 Kout95 changed the title 154 filter suggestions Add suggestions in search bar Jun 18, 2024
@Kout95 Kout95 changed the title Add suggestions in search bar Add autocomplete in search bar Jun 18, 2024
@Kout95 Kout95 marked this pull request as ready for review June 18, 2024 09:10
@Kout95 Kout95 changed the title Add autocomplete in search bar feat : add autocomplete in search bar Jun 18, 2024
@Kout95 Kout95 changed the title feat : add autocomplete in search bar Feat : add autocomplete in search bar Jun 18, 2024
@Kout95 Kout95 changed the title Feat : add autocomplete in search bar Feat: add autocomplete in search bar Jun 18, 2024
@Kout95 Kout95 changed the title Feat: add autocomplete in search bar feat: add autocomplete in search bar Jun 18, 2024
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kout95

Requested changes are mostly semantic :-)

I will test it as soon as you have amended it.

frontend/public/off.html Outdated Show resolved Hide resolved
Comment on lines 5 to 7
export const getTaxonomyName = (taxonomy: string): string => {
return `${taxonomy}`.replace('s_tags', '').replace('ies_tags', 'y');
return `${taxonomy}`.replace('ies_tags', 'y').replace('s_tags', '');
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be deduced this way, it's brittle and very specific to current configuration.

We have to open a ticket to make it better. I think the best would be for the developer to specify suggestion source in the component, or we make a specific API point for the facet suggestion that seeks for right completion in the configuration.

frontend/src/mixins/autocomplete.ts Outdated Show resolved Hide resolved
frontend/src/mixins/search-ctl.ts Show resolved Hide resolved
frontend/src/mixins/search-ctl.ts Outdated Show resolved Hide resolved
frontend/src/search-bar.ts Outdated Show resolved Hide resolved
Comment on lines +76 to +77
* Handle the input event
* It will update the query and call the getTaxonomiesTerms method to show suggestions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good comment 🙂

frontend/src/search-bar.ts Outdated Show resolved Hide resolved
frontend/src/search-bar.ts Outdated Show resolved Hide resolved
frontend/src/search-bar.ts Outdated Show resolved Hide resolved
@Kout95 Kout95 requested a review from alexgarel June 19, 2024 17:54
Comment on lines +121 to +123
return document.querySelectorAll(
`searchalicious-facets[search-name=${this.name}]`
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not work with default name, but I will fix this with a commit before testing.

@alexgarel
Copy link
Member

@Kout95 FYI I added a small commit with a very small refactor.

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great ! Thank you @Kout95

@alexgarel alexgarel merged commit 263834a into main Jun 20, 2024
6 checks passed
@alexgarel alexgarel deleted the 154-filter-suggestions branch June 20, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants