lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: How to use PhraseQuery Class?
Date Wed, 16 Jun 2004 13:06:53 GMT
On Jun 16, 2004, at 8:45 AM, Daniel de Souza Teixeira wrote:
> Do I need to use some special kind of Analyzer on the index method ?

What analyzer did you use?  SimpleAnalyzer lowercases....

> PhraseQuery query = new PhraseQuery();
> query.setSlop(2);
> query.add(new Term("contents", "How"));
> query.add(new Term("contents", "can"));
>
> System.out.println( "Query: " + query.toString());
>
> Hits hits = searcher.search(query);

And so your "How" term should be "how" in order to match what you 
indexed.

Be sure to read and understand issues you can encounter with analysis 
in the picture, or in your case in the picture during indexing, but not 
during querying:

	http://wiki.apache.org/jakarta-lucene/AnalysisParalysis

In other words, knowing *exactly* what you indexed is extremely vital 
in understanding issues with querying.

	Erik


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