lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Taylor <paul_t...@fastmail.fm>
Subject Problem searching non analyzed fields
Date Tue, 29 Sep 2009 22:16:32 GMT
I  use the same Analyzer for both creating an index and searching 
however I'm having a problem with some fields that I added with 
Field.Index.NOT_ANALYZED, how can I enforce they are also search without 
being analysed.

I did this for some fields containg Guids and products codes because I 
didn't want them modifying/tokenizing at all and it works fine for 
Guids, however one of these fields contains Amazon Id of B00004Y6O9 and 
I think when I search for this it fails because the analyzer I'm using  
lowercases all text and nowhere do I specify when parsing not to use the 
analyzer when searching, but of course its not getting lowercased when 
added to the index.

code extract:
IndexSearcher is = IndexSearcher(IndexReader.open(new NIOFSDirectory(new 
File(indexDir + '/' + indexName + '/'), null), true));
QueryParser qp = new QueryParser(defaultFields.get(0), analyzer);
TopScoreDocCollector collector = TopScoreDocCollector.create(offset + 
limit, true);
searcher.search(parser.parse(query), collector);

So how do I tell the parser not to analyse some fields, Im guessing the 
idea  is to subclass the QueryParser  but how, or should I be using 
Field.Index.ANALYZED when adding to the index

thanks Paul



---------------------------------------------------------------------
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