zend-search-lucene

Zend_Search_Lucene - How do I limit the results to a certain 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.


Solution

  • 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.