tags:

views:

673

answers:

1

I want to perform a search on a text field in Solr. I want to return all matches in a range or where there is no value. The two searches word independently:

myfield:[start TO finish]
-myfield:[* TO *]

The first returns all matches in the range. The second returns all matches that have no value for the "myfield" field. The problem is combining these two.

This returns no matches:

myfield:[start TO finish] OR -myfield:[* TO *]

This returns matches between start and finish, but not null entries:

myfield:[start TO finish] OR (-myfield:[* TO *])
+2  A: 

Try this.

Mauricio Scheffer
Perfect, thanks. For clarity, exact solution is: -(-myfield:[start TO finish] AND myfield:[* TO *])
Doolwind