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

Terms: Adjust fuzziness for admin term search queries #2417

Merged
merged 4 commits into from
Oct 20, 2021
Merged

Terms: Adjust fuzziness for admin term search queries #2417

merged 4 commits into from
Oct 20, 2021

Conversation

rebeccahum
Copy link
Contributor

Description of the Change

This fixes a bug when searching in the admin for post tags and the results are unexpected. To reproduce:

  1. Enable feature terms wp elasticpress activate-feature terms
  2. Run wp elasticpress index --setup
  3. Create three post tags:
  • Test Post
  • Test Ruth
  • The Most Fun Thing
  1. Search for "the most fun thing" and you will see that all terms are being returned

It doesn't make sense to have fuzzy search enabled for terms in the back-end, especially since users are most likely to be searching for a specific word in the tags..

Alternate Designs

We could change the default to be 0 instead of 1 but I'm not sure how far reaching that would be for non-admin term queries:

'fuzziness' => apply_filters( 'ep_term_fuzziness_arg', 1, $prepared_search_fields, $query_vars ),

Benefits

Results will be more accurate when searching for a tag with a term in it.

Possible Drawbacks

For users who appreciate the fuzziness, they may be wondering why it is no longer there.

Verification Process

  1. Follow reproduction steps in "Description of the Change"
  2. Check out PR
  3. Do search again from step 4 and see just the one result: "The most fun thing"

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Changed: Terms search query in admin will not be fuzzy

@rebeccahum
Copy link
Contributor Author

Thanks for looking @felipeelia. Version tag has been changed.

@felipeelia felipeelia merged commit bf47f16 into 10up:develop Oct 20, 2021
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Oct 20, 2021
@rebeccahum rebeccahum deleted the fix_fuzziness_for_admin_terms_search branch October 26, 2021 20:21
rebeccahum added a commit to Automattic/ElasticPress that referenced this pull request Oct 28, 2021
* Terms: Adjust fuzziness for admin term search queries

Duplicate of my upstream PR: 10up#2417

* Remove whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants