Really straightforward question:

Why does Solr return 0 results when I query using only for, which is a stop word on my Solr setup?

IMO this scenario should behave as a query without any keywords at all, which is returning all legit results as expected.

1 Answer 1


Your question doesn't fully describe the setup you have, I'm assuming this is a followup to this: How to apply stop words at Solr query time?

Basically you're chaining up multiple clauses in an AND boolean query. Once Solr processes that it will remove the stopwords (as you expect).

So you end up with clause AND clause AND removed-stopword-clause (always FALSE) AND clause. The result of this will always be 0 results.

This is explained in greater detail here:

Specifically what is happening is that the query parser passes "of" to the analyzer for the name field, which removes the stopwords, including "of", which results in no term to be queried. A Lucene BooleanQuery with no terms will match... nothing. But then when you add another clause, you have the combination of an empty term, and a specific term, which is equivalent to just using the specific term. Think of a sequence of terms to be ANDed as a set - if a term analyzing to no terms, there are no terms to add to the set of terms to be ANDed.

Source: https://lucene.472066.n3.nabble.com/AND-query-not-working-on-stopwords-as-expected-tp4186817p4186843.html

  • Thanks Mark, maybe I had wrong expectations related to this subject. So basically if I still want to use stop words I'll have to change my keyword AND keyword AND keyword to keyword OR keyword OR keyword, otherwise a query with stop words will always have 0 results. Is this assumption right? Oct 29, 2019 at 15:10
  • 1
    Yea. Elsewhere in the linked article someone suggests to leave the stopwords IN the index, but filter them at query time. I don't think this would change the situation for you however.
    – Mark Cassidy
    Oct 29, 2019 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.