lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan O'Hara <>
Subject Re: Not able to search on UN_TOKENIZED fields
Date Thu, 05 Apr 2007 21:14:38 GMT
Hey Erick,

Thanks for the quick response.  I need a truly exact match.  What I  
ended up doing was using a TOKENIZED field, but altering the  
StandardAnalyzer's stop word list to include only the word/letter  
'a'.  Below is my searching code:

String[] stopWords = {"a"};
             StandardAnalyzer sa = new StandardAnalyzer(stopWords);
             QueryParser qp = new QueryParser("symbol", sa);
             Query queryPhrase = qp.parse(symbol.toUpperCase());
             Hits hits =;
             String hit;
             if(hits.length() > 0){
                 hit = hits.doc(0).get("count");
                 count = Integer.parseInt(hit);

Is the reason it wasn't working due to the fact that I'm passing in a  
StandardAnalyzer?  I thought that maybe the searching mechanisms  
would be able to use or not use an analyzer according to what the  
field.index value is.

One other question that you may have an answer to:  I'm eventually  
going to need to alter the stop word list to include all default stop  
words, except those that match certain criteria.  Can this be done?


On Apr 5, 2007, at 3:08 PM, Erick Erickson wrote:

> Yes, you can search on UN_TOKENIZED fields, but they're exact,
> really, really exact <G>.
> I'd recommend that you get a copy of Luke (google lucene luke) and
> examine your index to see what you actually have in your index.
> Also, you haven't provided us a clue what the actual query is. I'd
> use Query.toString().
> I suspect that the query is getting tokenized if you're using one
> of the normal Analyzers...
> Erick
> On 4/5/07, Ryan O'Hara <> wrote:
>> Hey,
>> I was just wondering if you are supposed to be able to search on
>> UN_TOKENIZED fields?  It seems like you can from the docs, but I have
>> been unsuccessful.  I want to do exact string matching on a certain
>> field without analyzer interference.
>> Thanks,
>> Ryan
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message