You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sebastien X <cv...@noos.fr> on 2003/09/15 01:42:56 UTC
différents Analyzer for 2 fields
Hi,
I've an another question.
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?
thanks in advance
Sébastien
Re: différents Analyzer for 2 fields
Posted by Sebastien X <cv...@noos.fr>.
>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.
Ok, I will do that.
Thanks for your help.
Sébastien.
Re: différents Analyzer for 2 fields
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
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.
Erik
Re: diff�rents_Analyzer_for_2_fields
Posted by Otis Gospodnetic <ot...@yahoo.com>.
You can write a custom Analyzer that performs different actions on
different fields. Check out the FAQ at jGuru for an example.
Otis
--- Sebastien X <cv...@noos.fr> wrote:
> Hi,
>
> I've an another question.
>
> 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?
>
> thanks in advance
>
> S�bastien
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com