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

Fixed search results were not limited to the selected language. #11

Closed
wants to merge 1 commit into from

Conversation

fabianmarz
Copy link

By default the index language is set to english and uses the stop word filter which contains the word it. Since this string is also the locale for the Italian language posts were not limited or not showing up when searching in this particular language. This could be fixed by changing the search field from an analysed text field to the keyword field.

Query:

GET /<my_index>/_analyze
{
  "field": "post_lang", 
  "text" : "it"
}

Result:

{
  "tokens" : [ ]
}

Query:

GET /<my_index>/_analyze
{
  "field": "post_lang.keyword", 
  "text" : "it"
}

Result:

{
  "tokens" : [
    {
      "token" : "it",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "word",
      "position" : 0
    }
  ]
}

When not customized, the filter removes the following English stop words by default:
a, an, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, such, that, the, their, then, there, these, they, this, to, was, will, with
Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-stop-tokenfilter.html

More information:

@strategio
Copy link
Member

Hi @fabianmarz, and thank you for your contribution.

We are collecting issues related to the WPML ElasticPress plugin before to schedule another dev cycle (we have no schedule yet for this).

Be sure that we'll take your suggestion into consideration (even if not in the short-term). Meanwhile, I guess you can live with your patch.

Thanks again!

Internal Ref: wpmlbridge-263

@decodekult
Copy link
Collaborator

This is covered now by #13 so no need to enforce the keyword usage.

Thanks @fabianmarz for bringing this up. I am closing this MR as obsolete.

@decodekult decodekult closed this Apr 14, 2023
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.

3 participants