[KinoSearch] Using multiple analyzers

Marvin Humphrey marvin at rectangular.com
Fri Aug 17 05:31:12 PDT 2007


On Aug 17, 2007, at 2:12 AM, Adam . wrote:

> I'm running v0.15. I want to make use of multiple (2) analyzers, so
> that I can benefit from stemming and stop-words for some fields (as
> default behaviour), whilst benefiting from 'exact matches' in other
> fields (by not stemming).

This is a good technique.

> How do I tell it to use the unstemmed analyzer for the title_unstemmed
> field? The docs emphasize the importance of using the same analyzer in
> both stages (build and search) but I cannot seem to do that as
> QueryParser can only take one analyzer.

In 0.15, you create two QueryParsers and OR the Query objects they  
output together using a BooleanQuery.  See BooleanQuery's docs for an  
example using one QueryParser and one hand-rolled Query object.

In the devel branch, these extra acrobatics aren't necessary, since  
QueryParser accepts a Schema and uses it to find the right Analyzer  
for each field.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/





More information about the KinoSearch mailing list