lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: Different analyzer per field ?
Date Tue, 17 Mar 2009 11:25:40 GMT
It is possible in two ways:

1. Use the analyzer class and generate a TokenStream/Tokenizer from it. Then
add the field using the c'tor taking a TokenStream. If you want to
additionally store the field, you have to add another field with the same
field name, but no index and store enabled. After that, the tokens from the
token stream (analyzed by your analyzer) are indexed in the field and the
full contents are stored (if applicable). But if you have different
analyzers you cannot use QueryParser with that.

2. Another option is PerFieldAnalyzerWrapper, that is a wrapper that chooses
the right underlying analyzer depending on the used field name. You can use
this for both indexing and query.


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: Raymond Balm├Ęs []
> Sent: Tuesday, March 17, 2009 12:17 PM
> To:
> Subject: Different analyzer per field ?
> I was looking for calling a different analyzer for each field of a
> document... looks like it is not possible.
> Do I have it right ?
> -Ray-

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message