Automattic / Automattic/jetpack
Search: allow matching on first 2 chars of second word
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Currently the index doesn't match until after the first two chars in many cases. Mostly because the size of the index explodes. This is probably ok for the first two characters, but not great on the second word where something like "smart c" and "smart co" does not match "smart coupon". We can probably improve this by running multiple searches on the api when nothing matches and try stripping off the extra chars. Better to show some results than none.
We could also look (again) at lowering the number of chars from 3 to 2, but the last time I tried that really exploded the index size: https://github.com/Automattic/wpes-lib/blob/master/src/common/class.wpes-analyzer-builder.php#L384
There are some other improvements we could make to that indexing if we were on a newer version of ES also.
Contributor guide
Research direction
Start by reviewing the index configuration in src/common/class.wpes-analyzer-builder.php around line 384 and tracing the search API behavior when no results match. Compare the proposed fallback searches with the existing Elasticsearch prefix limits. Done means queries such as “smart c” and “smart co” return results for “smart coupon” without causing unacceptable index growth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, php
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100