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 ultranerds <an...@gmail.com> on 2012/08/11 17:01:32 UTC

Whys this query not working?

Hi,

I'm a bit baffled as to why this querys not working for me:

((title:"test" OR title:"keywords") OR (description:"test" OR
description:"keywords") OR (tags:"test" OR tags:"keywords")) AND
(-title:"something" AND -tags:"something" AND -description:"something") AND
(cat_id:"1") AND (private:"0") 

If I remove the part:

AND (-title:"something" AND -tags:"something" AND -description:"something")

Then it works fine... but the stupid thing, is that there is NO place in
that result which as "something" as a value. Can anyone point me as to what
I'm doing wrong? Failing that, I'll have to remove the "prohibit" part of my
search system (which would be a shame) as its messing up queries that
*should* give results :(

TIA

Andy



--
View this message in context: http://lucene.472066.n3.nabble.com/Whys-this-query-not-working-tp4000598.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Whys this query not working?

Posted by ultranerds <an...@gmail.com>.
Aaah thanks that makes sense. I wasn't aware of that bug. Doing the suggested
changes manually in the query works perfectly (just gotta work out how to
edit the Perl module I'm using to generate that query, so that I can use
this slightly different syntax compared to what it outputs normally)

Thanks :)

Andy



--
View this message in context: http://lucene.472066.n3.nabble.com/Whys-this-query-not-working-tp4000598p4000683.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Whys this query not working?

Posted by Jack Krupansky <ja...@basetechnology.com>.
Two things.

1. There is a known bug related to field names immediately after a left 
parenthesis, so insert a space between any left parenthesis and field name.

2. Purely negative expressions don't always work. insert "*:*" before any 
purely negative expression.

So, for example, change:

((title:"test" OR title:"keywords") OR (description:"test" OR

to

(( title:"test" OR title:"keywords") OR ( description:"test" OR

Also, you can simplify (and fix):

AND (-title:"something" AND -tags:"something" AND -description:"something")

as:

AND (*:* -title:"something" -tags:"something" -description:"something")

Technically, I think you can enclose the entire positive portion of your 
query in parens and then leave off the "AND (*:*", so that the negative 
terms are part of the larger expression - and they generate a Lucene 
BooleanQuery with one or more "MUST" clauses and the negative clauses.

-- Jack Krupansky

-----Original Message----- 
From: ultranerds
Sent: Saturday, August 11, 2012 11:01 AM
To: solr-user@lucene.apache.org
Subject: Whys this query not working?

Hi,

I'm a bit baffled as to why this querys not working for me:

((title:"test" OR title:"keywords") OR (description:"test" OR
description:"keywords") OR (tags:"test" OR tags:"keywords")) AND
(-title:"something" AND -tags:"something" AND -description:"something") AND
(cat_id:"1") AND (private:"0")

If I remove the part:

AND (-title:"something" AND -tags:"something" AND -description:"something")

Then it works fine... but the stupid thing, is that there is NO place in
that result which as "something" as a value. Can anyone point me as to what
I'm doing wrong? Failing that, I'll have to remove the "prohibit" part of my
search system (which would be a shame) as its messing up queries that
*should* give results :(

TIA

Andy



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Whys-this-query-not-working-tp4000598.html
Sent from the Solr - User mailing list archive at Nabble.com.