Solr – Field Not Null Searches


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.

Solr – Great Article on Solr Guidelines for any Web Presence


A friend linked me the following article;

It’s a great write-up discussing several pitfalls most dev-shops encounter when implementing or maintaining solr for the first time. For example, we are preparing to launch a large project based on Solr and designed the queries to use the standard request handler, but according to the article it’s much better to use the dismax request handler instead. Given that the author’s of the article know what they are talking about, we are going to research the dismax request handler and implement it before launch.


Go to Top