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

BUG: Search Results Showing That Don't Contain The Search Term #2920

Closed
adam-vanbuskirk opened this issue Aug 2, 2022 · 2 comments
Closed

Comments

@adam-vanbuskirk
Copy link

Describe the bug
When searching for a term on our site (topclassactions.com), the results contain many posts that do not contain the search term. You can use kashima as an example. We have a DB of 3GB+ in Prod. The lower life cycle (Dev & Staging) return the correct results. The plugin is not. modified. I cannot figure out why our search returns bad results in Prod.

When this would happen previosuly, I would rebuild the index and it would fix itself. Now, rebuilding or syncing the index doesn't even fix it.

Steps to Reproduce

  1. Go to topclassactions.com
  2. Click the hour glass at the top right, enter kashima, an press enter.
  3. Click on page 6 in the pagination and find the post titled Kellog Hit with Class Action Lawsuit Over 'Real Fruit' Claims and do a control F for kashima and you won't find it. There are several other examples in that same search feed that don't contain the term.

Expected behavior
It should only return posts that contain the search term, in this case kashima

Screenshots
image
image

Environment information

  • WordPress version: 5.9.3
  • ElasticPress version: 4.2.2
  • Elasticsearch version: 7.9.3
  • What ElasticPress features do you have currently active? Post Search, Facets
@adam-vanbuskirk adam-vanbuskirk added the bug Something isn't working label Aug 2, 2022
@felipeelia
Copy link
Member

Hi @adam-vanbuskirk,

This is not a bug. By default, Elasticsearch will try to find similar words and not only exact matches. Looking at your screenshot I can see Kashi and that is just two letters different from Kashima.

If you want to disable that behavior, you can use the following snippet:

add_filter( 'ep_match_fuzziness', '__return_zero' );

To read more about Elasticsearch Fuzziness, you can access their docs.

@felipeelia felipeelia removed the bug Something isn't working label Aug 4, 2022
@kevinlisota
Copy link

@felipeelia the ep_match_fuzziness filter is deprecated, replaced by ep_post_match_fuzziness. However, returning zero to the new filter does not turn off fuzzy matching. What is the equivalent snippet for 4.3.0?

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

No branches or pull requests

3 participants