Thanks a lot. I am now indexing my id in lowercase and my problem is solved.
Regards, CM --- Uwe Schindler <u...@thetaphi.de> wrote: > 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: u...@thetaphi.de > > > > -----Original Message----- > > From: CM Wong [mailto:cmwo...@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-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org