lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: Problem searching non analyzed fields
Date Tue, 29 Sep 2009 22:23:29 GMT
try checking out PerFieldAnalyzerWrapper, so you can specify how each field
is handled, i.e. some fields with KeywordAnalyzer, other fields with
StandardAnalyzer, etc.

On Tue, Sep 29, 2009 at 6:16 PM, Paul Taylor <paul_t100@fastmail.fm> wrote:

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


-- 
Robert Muir
rcmuir@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message