autocomplete: avoid trimming trailing spaces in sanitizer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 259
- Forks
- 168
- Avg merge
- 6h 15m
- Merged PRs (30d)
- 1
Description
for the autocomplete endpoint specifically, the presence of a trailing whitespace character in the input text has semantic value.
it indicates a word-boundary and that the final word which has been typed was completed and does not potentially represent a prefix.
looking at the sanitiser code, we trim whitespace from both sizes of the input before passing down to the tokenizer and parser functions which could use that information to make better decisions about what sort of queries to generate.
for example, the following queries should return different results, but currently return the same thing:
/v1/autocomplete?layers=country&text=uk
... should return
Ukraine
United Kingdom
/v1/autocomplete?layers=country&text=uk%20
... should *only* return
United Kingdom
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with sanitizer/_text.js, where the autocomplete input is trimmed before reaching the tokenizer and parser. Preserve the trailing whitespace signal for the autocomplete endpoint, then verify that inputs such as uk and uk%20 produce the distinct results described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100