Hi,

When I'm searching two keywords in Solr : "blue sky" , I got an OR operation (160 results, nothing pertinent).The expected AND operation is working only when I use + symbol: "blue + sky" (4 results)

The Solr schema.xml file seems to be fine :

And I tried to hack Solr_Base_Query.php in Solr module folder :

function __construct($operator = 'AND') {
$this->operator = $operator;
$this->id = ++SolrFilterSubQuery::$idCount;
}

I cleared the cache, reload tomcat, but OR is still the default logical operator.

Someone got this issue too ?

Comments

dams_26’s picture

and the Solr schema.xml file seems to be fine :

<solrQueryParser defaultOperator="AND"/>

pwolanin’s picture

Status: Active » Fixed

you want to change the mm parameter. The default operator is only relevant for raw lucene queries.

compare the Drupal 6.x-1.x default mm param, requires 65% of the terms to match, to 7.x-1.x requires only one of the terms to match.

change the mm param to 100% for 7.x to make search behave as AND instead of OR.

dams_26’s picture

Issue fixed,
Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

acbramley’s picture

Thank you so much @pwolanin, I couldn't figure out why upgrading my solr version changed the behaviour of my search. The "mm" parameters default value has changed since the previous version of apachesolr I was using. I was attempting to set mm in solrconfig.xml which wasn't working. Luckily doing it in query_alter() works perfectly!

acbramley’s picture

Issue summary: View changes

quote