3

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.

2 Answers 2

1

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 *])))

Sign up to request clarification or add additional context in comments.

Comments

0

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

5 Comments

If I try to perform: -(time:[1521 TO *] OR (time:[* TO 1519] OR time:[1521 TO *])) The result is the item with time=1520 If I try this: time:90000 OR -(time:[1521 TO *] OR (time:[* TO 1519] OR time:[1521 TO *])) I have no results...
Can you try this also time:90000 OR (-(time:[1521 TO ] OR (time:[ TO 1519] OR time:[1521 TO *])) <asterisk>:<asterisk> ) . Pls replace <asterisk> by *
Also include debugQuery=ON in your query. See wiki.apache.org/solr/CommonQueryParameters#debugQuery
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 *])))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.