开发者

Zend_Search_Lucene - How do I limit the results to a certain language?

开发者 https://www.devze.com 2022-12-09 07:32 出处:网络
I have indexed a website which is available in 14 languages, so far so good. Now I want to limit my lucene search to display only results in the visitor\'s language.

I have indexed a website which is available in 14 languages, so far so good. Now I want to limit my lucene search to display only results in the visitor's language.

开发者_开发技巧Is there any (query)parameter or any option that I can set? Unfortunately I did not find anything.

I am working with Zend_Search_Lucene if this should be relevant.


Because different languages would require different Analyzers and Tokenizers, I'd expect that you'll be maintaining a separate Index for each language, in which case the problem is trivial.

If you're not maintaining a separate index for each language, you'll have to put a non-tokenized Field in each Document containing a language keyword (such as "English" or "Spanish"), and add a BooleanFilter to your query, specifying that each Hit must match that keyword.

0

精彩评论

暂无评论...
验证码 换一张
取 消