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

Add exact elasticsearch mapping #7440

Merged
merged 3 commits into from Jun 20, 2023
Merged

Conversation

oetherington
Copy link
Collaborator

@oetherington oetherington commented Jun 19, 2023

We recently had a bug report where a search for "communism" (with and without quotes) was returning results for "community". This happens because elasticsearch stems both words into "commun", which is fine without quotes but totally incorrect with quotes.

This PR adds explicit mappings for all full-text fields to index them with two separate analyzers; one with stemming and synonyms and one without. Normal queries do not need to change, and we can now fix the bug when searching with quotes by simple appending .exact to the field names. That is, the field body now contains the stemmed and synonynmed value, and body.exact has the unstemmed version.

This PR requires running Globals.elasticConfigureIndexes(). I've already done this on dev, but not staging or prod. It is safe to run before deploying.

┆Issue is synchronized with this Asana task by Unito

@oetherington oetherington marked this pull request as ready for review June 19, 2023 12:23
@oetherington oetherington requested a review from a team as a code owner June 19, 2023 12:23
@oetherington oetherington requested review from Will-Howard and removed request for a team June 19, 2023 12:23
@Will-Howard Will-Howard removed their assignment Jun 20, 2023
@oetherington oetherington merged commit 7e8d9cc into master Jun 20, 2023
10 checks passed
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.

None yet

2 participants