lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: analyzer to populate more that one field of Lucene document
Date Fri, 22 Sep 2006 00:53:42 GMT
I think you want a PerFieldAnalyzerWrapper. It allows you to make a
different analyzer for each field in your document. You'll have to write the
code to extract the file contents in your desired formats for each field,
but you probably do that already <G>...

You can instantiate your IndexWriter with an instance of a
PerFieldAnalyzerWrapper and it all "just happens" after that......


>From the javadoc for PerFieldAnalyzerWrapper...
<<< This analyzer is used to facilitate scenarios where different fields
require different analysis techniques.>>>

Best
Erick

On 9/21/06, Boris Galitsky <bg7550@rambler.ru> wrote:
>
> I need to create two fields for Lucene documents populated
> 1) by numbers
> 2) by other strings
> 3) by values of another specific format
>
> What kind of Analyzer would do it?
>
> Using the customized analyzer, the current code is like
>
> IndexWriter indexWriter = new IndexWriter(indexDir, analyzer, true);
> Document doc = new Document();
>     doc.add(new Field("numeric_contents", new FileReader(f))); //
> numeric tokens
>     doc.add(new Filed("other_contents", new FileReader(f)));       //the
> same file but other than numeric tokens
>
> Thanks
> --
> Boris Galitsky.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message