Finding a date range or null / no field in Solr

I want to search in a text box in Solr. I want to return all matches in a range or where there is no value. Two search words independently:

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

The first returns all matches in the range. The second returns all matches that do not matter for the "myfield" field. The problem is combining the two.

This does not return matches:

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

This returns matches between the start and end, but not empty entries:

 myfield:[start TO finish] OR (-myfield:[* TO *]) 
+29
solr
Aug 27 '09 at 21:20
source share
2 answers

The solution from Mauricio Scheffer worked for me until I included it in the full request. The request itself can contain up to three fields with ranges and somewhere in the middle Solr could not process it. I managed to solve it with the following query:

 (myfield:[start TO finish] OR (*:* NOT myfield:[* TO *])) 

It went down even in my complex query, so maybe this will help someone else.

+4
May 26 '14 at 14:01
source share

I agree with the decision of Maurizio Scheffer.

If this can help, I converted my initial request:

 DocSource:"P" OR ( DocSource:"E" AND (MyDate:[NOW TO *] OR -MyDate:[* TO *] ) ) 

For

 DocSource:"P" OR ( DocSource:"E" AND -( -MyDate:[* TO NOW] AND MyDate:[* TO *] ) ) 

The first request did not execute as expected in Solr 4.1.

+2
Feb 20 '13 at
source share



All Articles