solrdatastaxdatastax-enterprisesolr-query-syntax

Isnull equivalent in SOLR


My query in sql server is like where isnull(id,'3') = 3 which would give me all null values as well as values equal to 3. I want to achieve the same in SOLR but not able to get it. I tried

id:3 OR -id:[* TO *]

but it gave me no result whereas on -id:[* TO *] it gives me correct amount of results. How do I make the query?


Solution

  • maybe the issue here is the precedence of the operators, - is being applied to both condition or something like that (might be a bug), anyway, this works:

    q=(-id:[* TO *]) OR id:3