Closed (fixed)
Project:
Apache Solr Search
Version:
7.x-1.x-dev
Component:
schema.xml
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 May 2012 at 13:38 UTC
Updated:
16 Jul 2013 at 05:21 UTC
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
Comment #1
dams_26 commentedand the Solr schema.xml file seems to be fine :
<solrQueryParser defaultOperator="AND"/>Comment #2
pwolanin commentedyou 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.
Comment #3
dams_26 commentedIssue fixed,
Thanks
Comment #5
acbramley commentedThank 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!
Comment #5.0
acbramley commentedquote