Skip to content

Search autocomplete#164

Merged
rosemcc merged 15 commits into
masterfrom
search-autocomplete
Nov 7, 2021
Merged

Search autocomplete#164
rosemcc merged 15 commits into
masterfrom
search-autocomplete

Conversation

@rosemcc
Copy link
Copy Markdown
Contributor

@rosemcc rosemcc commented Nov 3, 2021

New feature search autocomplete

When entering a search query the user is shown a dropdown list of search suggestions that they can select from. Autocomplete suggestions include all published page titles in the CMS as well as a manually-curated list of popular search terms that have been used in the past by ResearchHub users - derived from the Google Analytics Site Search data.

  • Search autocomplete service stores the list of popular terms and performs a GraphQL query to load all page titles from Contentful
  • The Search Bar component uses the autocomplete service to obtain the list of autocomplete terms
  • It uses the Angular Material autocomplete component to render the autocomplete options
  • The search bar component search input is changed to a reactive form so the user input can be observed as a stream
  • The user input is used to filter the list of autocomplete terms to show only terms that match the input
  • The input and autocomplete terms are lowercased, leading and trailing whitespace is removed and diacritic marks are ignored

@rosemcc rosemcc requested a review from Trombach November 3, 2021 02:03
Copy link
Copy Markdown
Contributor

@Trombach Trombach left a comment

Choose a reason for hiding this comment

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

LGTM! I like how this is done with very little code. Just one suggestions that I added as a comment :)

Comment thread research-hub-web/src/styles.scss Outdated
@rosemcc rosemcc merged commit 1908f64 into master Nov 7, 2021
@rosemcc rosemcc deleted the search-autocomplete branch November 7, 2021 21:41
@rosemcc rosemcc mentioned this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants