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.

Reply via email to