OR/NOT query syntax

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OR/NOT query syntax

Andrew Wall
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
Reply | Threaded
Open this post in threaded view
|

Re: OR/NOT query syntax

Jonathan Haddad
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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: OR/NOT query syntax

Yonik Seeley-2-2
In reply to this post by Andrew Wall
On Wed, Mar 11, 2009 at 9:56 PM, Andrew Wall <[hidden email]> 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