lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sascha Szott <>
Subject problem with formulating a negative query
Date Tue, 29 Jun 2010 15:00:39 GMT
Hi folks,

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.

Unfortunately, the query

/select?q={!lucene q.op=OR df=topic}(R NOT [* TO *])

does not return any docs even though there are documents in my index 
that fulfil the specified condition as you can deduce from the queries 
listed below:

/select?q=topic:R  returns > 0 docs

/select?q=-topic:[* TO *]  returns > 0 docs

Appending the query with debugQuery=true returns:
<str name="rawquerystring">{!lucene q.op=OR df=topic}(R NOT [* TO *])</str>
<str name="querystring">{!lucene q.op=OR df=topic}(R NOT [* TO *])</str>
<str name="parsedquery">topic:R -topic:[* TO *]</str>
<str name="parsedquery_toString">topic:R -topic:[* TO *]</str>

Does anybody have a clue of what is wrong here?

Thanks in advance,

View raw message