Uh, I'm not sure if this is in the Lucene FAQ, but it ought to be.  The "+" 
means that the term/clause MUST be in a document if a document is to be counted 
as a match.  The "-" means that the term/clause MUST NOT be in a document if a 
document is to be counted as a match.

Is this even syntactically correct:
  field1:(-value1) 
vs.
 -field1:value1

I suppose it is if you the QueryParser is not blowing up...

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Lyman Hurd <[EMAIL PROTECTED]>
> To: "solr-user@lucene.apache.org" <'solr-user@lucene.apache.org'>
> Sent: Thursday, August 28, 2008 3:06:52 PM
> Subject: question about + and - in field queries
> 
> We are trying to use the "+" (mandatory) and "- "(forbidden) modifiers
> in field queries but we do not seem to be getting what we expected.
> 
> 
> 
> Specifically our query is: 
> 
> 
> 
> field1:(-value1) field2:value2
> 
> 
> 
> as an alternative we tried:
> 
> 
> 
> -field1:value1 field2:value2
> 
> 
> 
> which appears to behave as if the two conditions were separated by
> "and".
> 
> 
> 
> There would seem to be two logical alternatives.  One would be that it
> would return all results that satisfied both halves (an implicit AND),
> and the other that it returns results satisfying at least one (implicit
> OR).  We have verified that the search behavior does not change if one
> replaces the space between the terms with an explicit OR which is
> consistent with the default.  However, what is being returned is simply
> those entried satisfying the second condition (all the returns happen to
> violate the first) and no results are returned that satisfy the first
> but not the second.
> 
> 
> 
> Another query:
> 
> 
> 
> field1:(+value1) field2:value2
> 
> 
> 
> is giving precisely the same results as:
> 
> 
> 
> field1:value1 field2:value2
> 
> 
> 
> instead of giving only results which satisfy the first condition.
> 
> 
> 
> Can someone give a concise explanation of exactly how "+" and "-"
> interact when used across fields.  I am not able to reconcile the
> behavior with the description in the Lucene syntax documentation.
> 
> 
> 
> Thanks,
> 
> 
> 
> Lyman
> 
> Lyman Hurd
> Sr. Principal Engineer
> Interwoven, Inc.
> 404.264.8068
> [EMAIL PROTECTED]
> Visit www.interwoven.com
> The Next-Generation Enterprise Content Management Company 

Reply via email to