solrsolr6

AND in solr query returns more results


First of all, I'm not very experienced in using Solr, so I hope this isn't a stupid question .. I am experiencing some unexpected behavior with a Solr query. Suppose the query is q="Foo:"Bar" . Now make it q="Foo:"Bar" AND() and we get more results back, which just seem random and certainly not meeting condition "Foo" = "Bar".

Am I missing something here? It doesn't seem logical that an extra condition would return more results instead of less.


Solution

  • Your example queries are not valid Solr queries - if you want to query the field "Foo" for the value "Bar", do Foo:Bar. The AND clause is used between several terms to combine the result for all the terms, i.e. Foo:Bar AND Spam:Eggs.

    Your example probably just got parsed to be either Foo:Bar or the value AND somewhere in the default search field.