Solr Index appears to be valid - but returns no results

I had the same issue with a new setup of Solr 8. The accepted answer is not valid anymore, because the <defaultSearchField> configuration will be deprecated.

As I found no answer to why Solr does not return results from any fields despite being indexed, I consulted the query documentation. What I found is the DisMax query parser:

The DisMax query parser is designed to process simple phrases (without complex syntax) entered by users and to search for individual terms across several fields using different weighting (boosts) based on the significance of each field. Additional options enable users to influence the score based on rules specific to each use case (independent of user input).

In contrast, the default Lucene parser only speaks about searching one field. So I gave DisMax a try and it worked very well!

Query example:

http://localhost:8983/solr/techproducts/select?defType=dismax&q=video

You can also specify which fields to search exactly to prevent unwanted side effects. Multiple fields are separated by spaces which translate to + in URLs:

http://localhost:8983/solr/techproducts/select?defType=dismax&q=video&qf=features+text

Last but not least, give the fields a weight:

http://localhost:8983/solr/techproducts/select?defType=dismax&q=video&qf=features^20.0+text^0.3

If you are using pysolr like I do, you can add those parameters to your search request like this:

results = solr.search('search term', **{
    'defType': 'dismax',
    'qf': 'features text'
})

Probably you don't have a <defaultSearchField> correctly set up. See this question.

Another possibility: your field is of type string instead of text. String fields, in contrast to text fields, are not analyzed, but stored and indexed verbatim.


In my case the problem was the format of the query. It seems that my setup, by default, was looking and an exact match to the entire value of the field. So, in order to get results if I was searching for the sit I had to query *sit*, i.e. use wildcards to get the expected result.