Epinova / Epinova.Elasticsearch

A search-plugin for Episerver CMS and Commerce
MIT License
29 stars 20 forks source link

Get correct lang in ElasticSearchService #123

Closed hakonn closed 2 years ago

hakonn commented 3 years ago

Get search result from ElasticSearchService if the site is using languages with location, like nb-no and nn-no.

hakonn commented 3 years ago

I notice that some unit tests aren't too happy with my pull request. So, to be a bit bold, I'll say that the unit tests are wrong. Because:

If you setup a new episerver site, add for instance en-gb as a language, add epinova elastic plugin, press the "Create or update indices" button in the Search dashboard (/ElasticSearchAdmin/ElasticAdmin), the index for en-gb will we be created and named "index-name-en-gb".

Then if you use the ElasticSearchService to query some result in that language, en-gb, you will not hit that index. Because the current Language.GetLanguageCode method will return "en" instead of "en-gb", and ElasticSearchService will then try to open an index with the following name "index-name-en" which is wrong because the index name is "index-name-en-gb".

Or have I misunderstood something(?).

KolbeinFoldoy commented 3 years ago

Will this PR be merged anytime soon, @otanum ? Can't currently use Epinova Elasticsearch with Episerver sites with both nb-NO and nn-NO. Found any workaround, @hakonn ?

otanum commented 3 years ago

I will take a look at it @KolbeinFoldoy. I do not have any time for ElasticSearch this week.

TopalovOleg commented 2 years ago

@otanum any news 1 year later? Is this project still supported?

otanum commented 2 years ago

I am in the process of adding support for non neutral cultures. This pull request will not be merged as it adds more Episerver dependencies in the Core project.

I have added ISearchLanguage interface with default implementation in the Core project. Another implementation is added to the Episerver project.

Code: https://github.com/Epinova/Epinova.Elasticsearch/blob/Release/SupportNonNeutralLanguages/src/Epinova.ElasticSearch.Core.EPiServer/EpiserverSearchLanguage.cs