You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2017/06/20 11:39:47 UTC

lucene-solr:master: SOLR-4646: eDismax lowercaseOperators now defaults to "false" for luceneMatchVersion >= 7.0.0

Repository: lucene-solr
Updated Branches:
  refs/heads/master 39dfb7808 -> 8648b005e


SOLR-4646: eDismax lowercaseOperators now defaults to "false" for luceneMatchVersion >= 7.0.0


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/8648b005
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/8648b005
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/8648b005

Branch: refs/heads/master
Commit: 8648b005e28d24b7e18726502ae1ea5fffa44a5c
Parents: 39dfb78
Author: Jan Høydahl <ja...@apache.org>
Authored: Tue Jun 20 13:39:36 2017 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Tue Jun 20 13:39:36 2017 +0200

----------------------------------------------------------------------
 solr/CHANGES.txt                                          |  5 +++++
 .../org/apache/solr/search/ExtendedDismaxQParser.java     |  7 +++++--
 .../org/apache/solr/search/TestExtendedDismaxParser.java  | 10 +++++++++-
 .../src/the-extended-dismax-query-parser.adoc             |  1 +
 solr/webapp/web/js/angular/controllers/query.js           |  2 +-
 5 files changed, 21 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8648b005/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9267039..a201d1e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -102,6 +102,9 @@ Upgrading from Solr 6.x
      curl http://host:8983/solr/mycollection/config -d '{"set-user-property": {"update.autoCreateFields":"false"}}'
   Please see SOLR-10574 for details.
 
+* The default for eDismax parameter 'lowercaseOperators' now depends on the luceneMatchVersion setting in solrconfig.
+  It remains 'true' for luceneMatchVersion < 7.0.0 and changes to 'false' from 7.0.0. See also SOLR-4646
+
 New Features
 ----------------------
 * SOLR-9857, SOLR-9858: Collect aggregated metrics from nodes and shard leaders in overseer. (ab)
@@ -293,6 +296,8 @@ Other Changes
 
 * SOLR-9623: Disable remote streaming in example configs by default. Adjust Upload Limit defaults (janhoy, yonik)
 
+* SOLR-4646: eDismax lowercaseOperators now defaults to "false" for luceneMatchVersion >= 7.0.0 (janhoy, David Smiley)
+
 ==================  6.7.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8648b005/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
index a68836c..9ec07e8 100644
--- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java
@@ -46,6 +46,7 @@ import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.lucene.search.MultiPhraseQuery;
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.Query;
+import org.apache.lucene.util.Version;
 import org.apache.solr.analysis.TokenizerChain;
 import org.apache.solr.common.params.DisMaxParams;
 import org.apache.solr.common.params.SolrParams;
@@ -1703,8 +1704,10 @@ public class ExtendedDismaxQParser extends QParser {
       mmAutoRelax = solrParams.getBool(DMP.MM_AUTORELAX, false);
       
       altQ = solrParams.get( DisMaxParams.ALTQ );
-      
-      lowercaseOperators = solrParams.getBool(DMP.LOWERCASE_OPS, true);
+
+      // lowercaseOperators defaults to true for luceneMatchVersion < 7.0 and to false for >= 7.0
+      lowercaseOperators = solrParams.getBool(DMP.LOWERCASE_OPS,
+          !req.getCore().getSolrConfig().luceneMatchVersion.onOrAfter(Version.LUCENE_7_0_0));
       
       /* * * Boosting Query * * */
       boostParams = solrParams.getParams(DisMaxParams.BQ);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8648b005/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
index 46bebb3..0dc327d 100644
--- a/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
+++ b/solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java
@@ -189,6 +189,14 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {
               "defType", "edismax")
           , "*[count(//doc)=0]");
 
+      assertQ("The default for lowercaseOperators should not allow lower case and",
+          req("q", "Zapp and Brannigan",
+              "qf", "name",
+              "q.op", "AND",
+              "sow", sow,
+              "defType", "edismax")
+          , "*[count(//doc)=0]");
+
       assertQ("Lower case operator, allow lower case operators",
           req("q", "Zapp and Brannigan",
               "qf", "name",
@@ -284,7 +292,7 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {
                "q","Order AND op"), oner
     );
    assertQ(req("defType", "edismax", "qf", "name title subject text",
-               "q","Order and op"), oner
+               "q","Order and op"), twor
     );
     assertQ(req("defType", "edismax", "qf", "name title subject text",
                "q","+Order op"), oner

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8648b005/solr/solr-ref-guide/src/the-extended-dismax-query-parser.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/the-extended-dismax-query-parser.adoc b/solr/solr-ref-guide/src/the-extended-dismax-query-parser.adoc
index c0fdcae..e949a61 100644
--- a/solr/solr-ref-guide/src/the-extended-dismax-query-parser.adoc
+++ b/solr/solr-ref-guide/src/the-extended-dismax-query-parser.adoc
@@ -59,6 +59,7 @@ A multivalued list of strings parsed as queries with scores multiplied by the sc
 === The lowercaseOperators Parameter
 
 A Boolean parameter indicating if lowercase "and" and "or" should be treated the same as operators "AND" and "OR".
+Defaults to `false`.
 
 [[TheExtendedDisMaxQueryParser-ThepsParameter]]
 === The ps Parameter

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8648b005/solr/webapp/web/js/angular/controllers/query.js
----------------------------------------------------------------------
diff --git a/solr/webapp/web/js/angular/controllers/query.js b/solr/webapp/web/js/angular/controllers/query.js
index 5dd105b..3a44cbd 100644
--- a/solr/webapp/web/js/angular/controllers/query.js
+++ b/solr/webapp/web/js/angular/controllers/query.js
@@ -23,7 +23,7 @@ solrAdminApp.controller('QueryController',
     $scope.query = {wt: 'json', q:'*:*', indent:'on'};
     $scope.filters = [{fq:""}];
     $scope.dismax = {defType: "dismax"};
-    $scope.edismax = {defType: "edismax", stopwords: true, lowercaseOperators: true};
+    $scope.edismax = {defType: "edismax", stopwords: true, lowercaseOperators: false};
     $scope.hl = {hl:"on"};
     $scope.facet = {facet: "on"};
     $scope.spatial = {};