How to set solr default operator


I’m trying to set the default solr search operator for all searches to AND, but I can’t figure out how.
I came across this documentation, so I think I need to set q.op to AND, but where?

Any ideas?
Thanks in advance.

1 Like


I’ll try again with an example:

Our users use lot of tags in our wiki and when they search for “cookies coffee”, they expect to see pages that have both tags, “cookies” AND “coffee”, but they get pages that have either one of the tags or both of them.
They could type “cookies+coffee” to get the desired result, but that’s just not what most people do.

If AND was the default search operator, our users would get the results they expect, but I could not figure out a way to set it.
I tried to set q.op to AND for the /select solr.SearchHandler in solrconfig.xml but the search results stayed the same.

Does anyone know, where to set the default search operator? Is this even the right way to achieve what I described in the example?


You could also try the mm parameter . Edit Main.SolrSearchConfig and look for minShouldMatch.

Thanks for you answer. I’ve already set

  'minShouldMatch': '100%',

but the search results stay the same.