lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: différents Analyzer for 2 fields
Date Sun, 14 Sep 2003 23:54:42 GMT
On Sunday, September 14, 2003, at 07:42  PM, Sebastien X wrote:
> For indexing my documents I use this code :
> writer = new IndexWriter(index, new StandardAnalyzer(), create);
> I use 2 fields "content" and "title" but I would use différents 
> Analyzer for this 2 fields (one who could use numerical and the other 
> not, for example)
> Is there a way to do this?

You can only use one Analyzer per document and all tokenized fields 
will use that analyzer (an aside, you can change analyzers on a per 
document basis also).

But, you can create a custom Analyzer that does the right logic on a 
per-field basis easily by just copying the code from the Analyzers you 
want to use in there.  The tokenStream method you override provides the 
field name as a parameter.


View raw message