lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: NOT_ANALYZED field
Date Tue, 28 Apr 2009 12:33:48 GMT
That is normal. Fields that are not analyzed are indexed as single tokens.
The anaylzer does not only tokenize the text, it also transforms it (e.g. to
lower case). If you enter your search using the query parser, the entered
search terms are analyzed! And for full text engines, the analyzer for
querying and searching must be the same. So it is normal, that your search
will not return results (in your example, it would work, if the id would be
indexed in lower case, because the analyzer on top of your query string
lowercases the term).

So not-analyzed fields should be directly queried using TermQuery(....),
e.g. to find the document with an untokenized id.

If you really want to use query parser, think about PerFieldAnalyzerWrapper
using KeywordTokenizer for the id field.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: CM Wong [mailto:cmwong2@yahoo.com]
> Sent: Tuesday, April 28, 2009 2:26 PM
> To: java-user@lucene.apache.org
> Subject: NOT_ANALYZED field
> 
> 
> Hi,
> 
> In my simple program I have an ID field which is NON_ANALYZED. I find that
> if
> the field contains only numeric characters (e.g. id="00023"), I can
> successsfully search for the doc. (search for "id:00023")
> 
> But if the field contains non-numeric characates (e.g. id="nJK00023") then
> the
> search returns nothing. (search for "id:nJK00023")
> 
> Is there anything wrong with my program?
> 
> Regards,
> CM
> 
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message