views:

118

answers:

1

Hi folks,

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.

thanks!

+1  A: 

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.

Jonathan Feinberg
Currently I have only one index that contains everything. I wonder if it adds such a language keyword based on the HTML document's information such as <html xml:lang="de_DE" lang="de_DE"> - in this case I only had to add the appropriate filter. Otherwise - how do I add such a language keyword?
Alex
I got it working now, thanks!
Alex