lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rapthor <rapt...@lycos.de>
Subject AND query in SHOULD
Date Thu, 22 Nov 2007 11:07:16 GMT

Hi,

I want to realize a search that finds the exact phrase I provide. If the
word I am searching for is "green tree", I do NOT want to get results for
"green" or "tree", but only results for "green tree" within the given field.

This doesn't work so far for me. When providing a word that contains white
spaces, Lucene does not give any results at all even though there are
documents with the terms within the word in that order. This is what my
source looks:

BooleanQuery bq = new BooleanQuery();
for (String word : words) {
	for (String field : fields) {
		bq.add(new TermQuery(new Term(field, word)), Occur.SHOULD);
	}
}
Hits hits = indexSearcher.search(bq);

What's wrong? How to achieve the functionality?

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/AND-query-in-SHOULD-tf4855719.html#a13894829
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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