Category:Solr’
Solr not null queries
- by joerg
There may be occasions where you need to search a specific field in Solr where the field has non-null values, equivalent to:
SELECT field_name FROM my_table WHERE field_name IS NOT NULL;
Solr equivalent:
FieldName:['' TO *] |
You can also do the same for numeric ranges:
SELECT field_value FROM my_table WHERE field_value > 0;
Solr equivalent:
FieldValue:[1 TO *] |
As always, it’s best to try these types of queries via the admin interface before adding to code that actually constructs the Solr query.