lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Barr <mi...@runtime-collective.com>
Subject RE: Problem searching Field.Keyword field
Date Tue, 08 Feb 2005 14:32:34 GMT
Hi Mike,

If you use a different analyzer, say a custom one the didn't do anything
to the original search query, then you could use the query parser to
search on the keyword field. The standard analyzer does things like
making everything lowercase, removing stop words etc. Since the value
held in the keyword field didn't go through the same process during
indexing it won't come up as a match.

So basically you want to do:

...

IndexSearcher is = new IndexSearcher(fsDir);

...

Term t = new Term("keyword-field-name", keyword);
Query query = new TermQuery(t);
Hits hits = is.search(query);


You will typically only do this when you're trying to retrieve a
specific document, rather than doing a search.


-- 
Miles Barr <miles@runtime-collective.com>
Runtime Collective Ltd.

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message