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 "Satuluri, Venu_Madhav" <Ve...@deshaw.com> on 2006/04/05 13:52:29 UTC

Which Analyzer to use when searching on Keyword fields

Hi,

I am using lucene 1.4.3. Some of my fields are indexed as Keywords. I
also have subclassed Analyzer inorder to put stemming etc. I am not sure
if the input is tokenized when I am searching on keyword fields; I don't
want it to be. Do I need to have a special case in the overridden method
(Analyzer.tokenStream() ) to handle keyword fields? 

I've noticed that there's a KeywordTokenizer now in the API, but its not
there for lucene 1.4.3. If I was using 1.9, I could probably determine
if the field was a keyword one and then return a
KeywordTokenizer(Reader), but I am using 1.4.3.

Any advice is appreciated.
-Venu

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Which Analyzer to use when searching on Keyword fields

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Venu,

I presume you're asking about what Analyzer to use with QueryParser.   
QueryParser analyzes all term text, but you can fake it for Keyword  
(non-tokenized) fields by using PerFieldAnalyzerWrapper, specifying  
the KeywordAnalyzer for the fields you indexed as such.

The KeywordAnalyzer code will work with 1.4.3, so just grab that  
class and put it into your project.  A couple of variations of it are  
also included with the Lucene in Action code.

	Erik


On Apr 5, 2006, at 7:52 AM, Satuluri, Venu_Madhav wrote:

> Hi,
>
> I am using lucene 1.4.3. Some of my fields are indexed as Keywords. I
> also have subclassed Analyzer inorder to put stemming etc. I am not  
> sure
> if the input is tokenized when I am searching on keyword fields; I  
> don't
> want it to be. Do I need to have a special case in the overridden  
> method
> (Analyzer.tokenStream() ) to handle keyword fields?
>
> I've noticed that there's a KeywordTokenizer now in the API, but  
> its not
> there for lucene 1.4.3. If I was using 1.9, I could probably determine
> if the field was a keyword one and then return a
> KeywordTokenizer(Reader), but I am using 1.4.3.
>
> Any advice is appreciated.
> -Venu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org