lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: ORing complementary queries gives no results
Date Tue, 23 May 2006 18:18:23 GMT

I suspect the final query structure isn't what you think it is ... take a
look at the toString on your query.

in general, there is no way to just do a "NOT foo" type query ...
prohibiting things only makes sense in the context of selecting something
else ... i'm guessing the query structure you acctually have is...

	name:xyz -name:xyz

...which means positively select anything matching name:xyz and then
prohibit anything matching name:xyz ... hence the empty set.

if you truely want a "NOT foo" style clause which you can then combine
with other queries in a true boolean set fashion, you'll need to use a
MatchAllDocs query or soemthing like it...

       name:xyz (field_every_doc_has_set_to_true:true -name:xyz)



: Date: Tue, 23 May 2006 14:47:32 +0530
: From: "Satuluri, Venu_Madhav" <Venu.Madhav.Satuluri@deshaw.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: ORing complementary queries gives no results
:
: Hi all,
:
: I build Query objects programmatically. I do this by getting a
: TermQuery/PhraseQuery/whatever for each term in the user query, make a
: BooleanClause by specifying isRequired and isProhibited depending on
: whether the term has an "and" or an "or" or an "or not" etc prefixed
: before it (I use 1.4.3, which is why I use isRequired, isProhibited
: instead of BooleanClause.OCCUR). I combine all the BooleanClauses in the
: end to get my final Query.
:
: This is working fine, except for one case where I ORed two complementary
: queries, i.e. I searched for "name:xyz or -name:xyz". Both of these
: queries independently produce results but both joined together don't.
: The isRequired parameter is false for both the parts of the query, while
: isProhibited is true for the second and false for the first. Shouldn't
: this query return all the documents which have some value of the field
: "name"?
:
: Thanks,
: Venu
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
: For additional commands, e-mail: java-user-help@lucene.apache.org
:



-Hoss


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