Lorenzo
Lorenzo

Reputation: 41

Solr query syntax Issue

I'm trying to do the following query with Solr:

time:90000 OR (-time:[1521 TO *] AND -(time:[* TO 1519] OR time:[1521 TO *]))

it returns only one result with tag time=90000, but I have two items with tag time with value 90000 and 1520. I would like them both.

Can anyone give me some explaination? Thanks in advance.

Upvotes: 3

Views: 195

Answers (2)

Lorenzo
Lorenzo

Reputation: 41

I found the solution: when I perform a negative query, I must write:

*:* -<query>

For my issue, the solution is:

time:90000 OR (time:* -time:[1521 TO *] AND (time:* -(time:[* TO 1519] OR time:[1521 TO *])))

Upvotes: 1

Himanshu
Himanshu

Reputation: 2454

I think this is because negative queries are allowed at the top level only. See http://wiki.apache.org/solr/SolrQuerySyntax

Pure negative queries (all clauses prohibited) are allowed.

Try moving those negative queries out and post your findings here

Upvotes: 0

Related Questions