You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Andrew Wall <re...@gmail.com> on 2009/03/12 02:56:36 UTC

OR/NOT query syntax

I'm attempting to write a solr query that ensures that if one field has a
particular value that another field also have a particular value.   I've
arrived at this syntax, but it doesn't seem to work correctly.

((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)

either operand functions correctly on its own - but not when joined together
with the "or not" condition.  I don't understand why this syntax doesn't
work - can someone shed some light on this?

Thanks!
Andrew Wall

Re: OR/NOT query syntax

Posted by Jonathan Haddad <jo...@letsgetnuts.com>.
I might be wrong on this, but since you can't do a query that's just a
NOT statement, this wouldn't work either.  I believe the NOT must
negate results of a query, not the entire dataset.

On Wed, Mar 11, 2009 at 6:56 PM, Andrew Wall <re...@gmail.com> wrote:
> I'm attempting to write a solr query that ensures that if one field has a
> particular value that another field also have a particular value.   I've
> arrived at this syntax, but it doesn't seem to work correctly.
>
> ((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)
>
> either operand functions correctly on its own - but not when joined together
> with the "or not" condition.  I don't understand why this syntax doesn't
> work - can someone shed some light on this?
>
> Thanks!
> Andrew Wall
>



-- 
Jonathan Haddad
http://www.rustyrazorblade.com

Re: OR/NOT query syntax

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Mar 11, 2009 at 9:56 PM, Andrew Wall <re...@gmail.com> wrote:
> I'm attempting to write a solr query that ensures that if one field has a
> particular value that another field also have a particular value. I've
> arrived at this syntax, but it doesn't seem to work correctly.
>
> ((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)

Try
(myField:superneat AND myOtherField:somethingElse) OR (*:* -myField:superneat)

-Yonik
http://www.lucidimagination.com