strapi-plugin-meilisearch icon indicating copy to clipboard operation
strapi-plugin-meilisearch copied to clipboard

Add to choose language(localization) for search

Open KaylonMD opened this issue 1 year ago • 8 comments

Hi everyone! I use from documentation https://docs.meilisearch.com/learn/getting_started/quick_start.html#search function .search and get all documents needed, but problem is - need to filter / choose language before search phrases/word. At the moment show only initial locale from strapi, but other languages it puts in massive localizations, where can get documents.

Problem is - when put title from localizations document, meilisearch cannot search this document and give that not found something

KaylonMD avatar Mar 01 '23 09:03 KaylonMD

Hello @KaylonMD, Sorry, I'm not sure I completely understand you. Could you please provide more context about your setup? How did you handle the indexing of your documents in different languages? Do you have them separate in different indexes, or do your documents contain fields for each language? If you have configured the languages per index you should be able to select which index to target from the client side.

oluademola avatar Mar 13 '23 10:03 oluademola

Hello @KaylonMD, Sorry, I'm not sure I completely understand you. Could you please provide more context about your setup? How did you handle the indexing of your documents in different languages? Do you have them separate in different indexes, or do your documents contain fields for each language? If you have configured the languages per index you should be able to select which index to target from the client side.

At the moment, when i make request from Meilisearch, I get only primary localization documents, const client = new MeiliSearch({ host: MEILISEARCH_URL, apiKey: apiKey }); client .index(selectedIndex.index) .search(word) .then((res) => res.hits}); };

But unfortunately, the second language cannot pass, only can see in localizations

( Put url screen https://i.imgur.com/IXgB0Xr.jpeg ) - red underline is documents primary language, but if has translations, put in parameters translations, but cannot find it when search title name in function .search

KaylonMD avatar Mar 13 '23 10:03 KaylonMD

Hello @KaylonMD, Sorry, I'm not sure I completely understand you. Could you please provide more context about your setup? How did you handle the indexing of your documents in different languages? Do you have them separate in different indexes, or do your documents contain fields for each language? If you have configured the languages per index you should be able to select which index to target from the client side.

just need to get documents from "en" version and "ro" version

KaylonMD avatar Mar 13 '23 10:03 KaylonMD

@oluademola I am having the same problem, it seems entriesQuery: { locale: 'all'} doesn't work exactly like REST API's locale. In meilisearch documents, I see it only stores the 'en' version of entity instead of all locales, therefore the search only searched in 'en' documents.

You can see there are only 12/14 document stored in meilisearch, the extra 2 is in other locales. image

soapwong703 avatar Mar 22 '23 05:03 soapwong703

Hey @soapwong703, unfortunately currently it does not seem possible with the plugin. It would require multiple indexation of the same collection and that is not supported yet.

Meanwhile, if you use the localisation plugin you can play around with the locale parameter in the entriesQuery plugin parameter. See here

bidoubiwa avatar May 17 '23 10:05 bidoubiwa

@bidoubiwa any update about this, without localization this plugin is useless when you use multiple locales for your content on strapi

BenCherif avatar Apr 29 '24 13:04 BenCherif

Hello @BenCherif

Does https://github.com/meilisearch/strapi-plugin-meilisearch/pull/915 will fix your problem? If not, any PR are welcome and we will review it when we have some time 😊

curquiza avatar Apr 29 '24 13:04 curquiza

Hello @BenCherif

Does #915 will fix your problem? If not, any PR are welcome and we will review it when we have some time 😊

i'm not talking about the ui localizations , but i'm talking about retrieve entries with some locale from strapi .Can we add attribute {..., locale : en, } to meilisearch queries like we do already in strapi .Kind regards

BenCherif avatar Apr 29 '24 13:04 BenCherif