ElasticPressLabs icon indicating copy to clipboard operation
ElasticPressLabs copied to clipboard

BUG: WP_User_Query Search returns more results than expected

Open burhandodhy opened this issue 3 years ago • 3 comments

Describe the bug

WP_User_Query Search returns more results than expectation when we search for the user email. For example when I search for [email protected], ElasticPress also returns all the user those have gmail.com account

For example

Steps to Reproduce

  1. Create multiple users.
  2. Use WP_User_Query and search against any email address.
  3. EP returns more user than expectation.

burhandodhy avatar Oct 10 '22 13:10 burhandodhy

Hello! That's right, full-text search, the word gmail is everywhere.

  1. read https://github.com/10up/ElasticPressLabs/issues/62
  2. use sorting by relevance

ws256 avatar Oct 26 '22 05:10 ws256

We could store two fields for emails, one with the full email and another with its pieces (user, domain, etc.), so we could search through them separately. As that would require a change in the mapping, I'd prefer a smaller change that would fulfill our needs in this issue, but that could the fallback we need.

felipeelia avatar Feb 05 '25 14:02 felipeelia

@felipeelia Bad idea. Example, there is a login field, I have many users: user-8806019, user-0511554, etc. The search does not work because it splits the word by the hyphen. The results contain many thousands of matches for "user" value. Imagine how many variations there are in how to write an email address. Because of this, it was not possible to use the plugin in the admin panel to search for users. Need to configure Fuzziness for the fields. Or use some other parameters.

ws256 avatar Feb 05 '25 15:02 ws256