Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Search results will no longer disappear and reappear again as a user is typing a word in. Removing the stemmer from the search index pipeline stops the search term from being truncated when a search is made. This fixes alphagov#222. Description of issue -------------------- I noticed that certain searches have surprising behaviour as the search term was typed in; for instance, when searching for "documentation": - searching "d" gives 5 results - searching "do" gives 0 results - searching "doc", "docu", "docum", "docume", "documen", "document" gives 1 result - searching "documenta", "documentat", "documentati", "documentatio" gives 0 results - searching "documentation" gives 1 result This is surprising because search is incremental, meaning the results change a lot while typing a word. It is could also be confusing when searching for a particular long word; for instance, if someone was searching for references to "documentation" and there are a lot of results for "document" but none for "documenta" they might think that means they are no uses of the word "documentation" in the website. Fix --- This problem had already been identified in the Design System website, see commit alphagov/govuk-design-system@531d3c3. Thanks @36degrees for flagging that this fix existed. The fix is to remove the stemmer from the lunr pipeline. This is easily done with the fork of [middleman-search] that the tech-docs-gem uses. This commit also adds a simple test to prevent future changes breaking this functionality. [middleman-search]: https://github.com/alphagov/middleman-search
- Loading branch information