Try our conversational search powered by Generative AI!

Unable to search for content in "en-GB", Find is looking for content in "en"

Vote:
 

We have a large site with a number of language versions, and an onsite Find server.

When upgrading to Find 9.6 we started to notice that we no longer got a search result when the current language was English.

Default language for our site is en-GB. en-IE and en-US is also enabled, but the language "en" is not.

We use unified search in the simplest form:

 SearchClient.Instance.UnifiedSearchFor(SearchString)

I notice from Fiddler that when the search is sendt to EpiFind server, a number of criteria on "PublishedInLanguage.en" is set.

{"range":{"PublishedInLanguage.en.StartPublish$$date":{"from":"0001-01-01T00:00:00Z","to":"2016-01-28T06:58:00Z","include_lower":true,"include_upper":true}}

Problem is that there are no "en" language in the index.

I've experimented with the "QueryEPiServer Find" page on the Elasticsearch admin.

This query yields no hits:

{
  "from": 0,
  "size": 10,
  "query": {
    "query_string": {
      "fields": [
        "SearchTitle$$string.sv"
      ],
      "query": "*"
    }
  },
  "filter": {
    "range": {
      "PublishedInLanguage.en.StartPublish$$date": {
        "from": "0001-01-01T00:00:00Z",
        "to": "2016-01-01T00:00:00Z",
        "include_lower": true,
        "include_upper": true
      }
    }
  },
  "fields": [
    "PublishedInLanguage",
    "SearchHitUrl$$string"
  ]
}

By manually adding -GB to the languagecode like this:

"PublishedInLanguage.en-GB.StartPublish$$date": {

the server returns "a lot of hits"

As far as I can see, the "language" parameter on UnifiedSearchFor does not differensiate between the "flavours" of "en".

Question: How can I tell unified search that languagecode en-GB should be used and not just en?

Thanks in advance!

#143631
Jan 28, 2016 9:29
Vote:
 

Have you tried to reindex using the scheduled job? There was an earlier bug with Find when automatically updating index when publishing pages. Might be worth trying as work-around...

#143640
Jan 28, 2016 10:23
Vote:
 

Thanks for reply.

I've triggered a manual re-index - but the behaviour is still the same.

#143644
Jan 28, 2016 11:19
Vote:
 

We usually change the default filters in an initializable module, that seems to fix these kind of issues:

SearchClient.Instance.Conventions.UnifiedSearchRegistry.ForInstanceOf<PageData>()
    .PublicSearchFilter(client => client.BuildFilter<PageData>()
        .FilterForVisitor(ContentLanguage.PreferredCulture.ToString())
        .FilterOnCurrentSite()
        .ExcludeContainerPages()

Notice the overload in FilterForVisitor where we pass in the current content language.

#143648
Jan 28, 2016 13:11
Vote:
 

It seems like Find is not falling back on correct non-specific culture and vice versa.

#143649
Jan 28, 2016 13:13
Vote:
 

Thanks again for replies. 

I have solved this with a quickfix by using

SearchClient.Instance.UnifiedSearchFor(model.SearchString)
.OverrideCurrentLanguage(Language.None)

..if search is executed while in one of the english language modes (en-GB, en-US) and added a langugage filter on the search result.

For all other languages, I use UnifiedSearchFor without any language spesification, and it works as expected.

I will explore your suggestion when I have the time. 

#143662
Jan 28, 2016 15:12
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.