Hi Erick,
thanks for your explanations. But why are all docs being *removed* from
the set of all docs that contain R in their topic field? This would
correspond to a boolean AND and would stand in conflict with the clause
q.op=OR. This seems a bit strange to me.
Furthermore, Smiley & Pugh stated in their Solr 1.4 book on pg. 102 that
adding the a subexpression containing the negative query (-[* TO *]) and
the match-all-docs clause (*:*) is only a workaround. Why is this
workaround necessary at all?
Best,
Sascha
Erick Erickson wrote:
This may help:
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Boolean%20operators
But the clause you specified translates roughly as "find all the
documents that contain R, then remove any of them that match
"* TO *". * TO * contains all the documents with R, so everything
you just matched is removed from your results.
HTH
Erick
On Tue, Jun 29, 2010 at 12:40 PM, Sascha Szott<sz...@zib.de> wrote:
Hi Ahmet,
it works, thanks a lot!
To be true I have no idea what's the problem with
defType=lucene&q.op=OR&df=topic&q=R NOT [* TO *]
-Sascha
Ahmet Arslan wrote:
I have a (multi-valued) field topic in my index which does
not need to exist in every document. Now, I'm struggling
with formulating a query that returns all documents that
either have no topic field at all *or* whose topic field
value is R.
Does this work?
&defType=lucene&q.op=OR&q=topic:R (+*:* -topic:[* TO *])