lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
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

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Raymond Balm├Ęs [mailto:raymond.balmes@gmail.com]
> Sent: Tuesday, March 17, 2009 12:17 PM
> To: java-user@lucene.apache.org
> 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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message