You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Yousef Ourabi <yo...@gmail.com> on 2005/07/01 01:43:51 UTC

Nested Boolean Query

Hello:
I have two fields in my document a title, term and content. I want to
programatically create a query that will return all documents that has
both title AND content. I created a boolean query that looks like
this. The logican return I want are any documents that Must have the
alias passed to AliasQuery, and the query passed also shows up in a
field that has that alias. Basically filtering all documents of
alias=X with term = Y. Does this look right?

What I am getting are all documents by the alias (aliasQuery) orderd
by the search term, but also documents that don't have the query.

BooleanQuery termSearch = new BooleanQuery();
BooleanQuery combinedQuery = new BooleanQuery();
			
			
termSearch.add(termQuery, false, false);
termSearch.add(tittleQuery, false, false);
			
combinedQuery.add(aliasQuery, true, false);
combinedQuery.add(termSearch,false,false);


Best,
Yousef

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