lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject lucene-solr:branch_7_2: SOLR-11809: QueryComponent.prepare rq parsing could fail under SOLR 7.2.0 - fix: QueryComponent's rq parameter parsing no longer considers the defType parameter. (Christine Poerschke and David Smiley in response to bug report/anal
Date Mon, 08 Jan 2018 20:25:46 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7_2 dd2c90d76 -> 2ec80a272


SOLR-11809: QueryComponent.prepare rq parsing could fail under SOLR 7.2.0 - fix:
QueryComponent's rq parameter parsing no longer considers the defType parameter.
(Christine Poerschke and David Smiley in response to bug report/analysis from Dariusz Wojtas
and Diego Ceccarelli)


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

Branch: refs/heads/branch_7_2
Commit: 2ec80a272909588a2dd0f276ada4f798979c4fac
Parents: dd2c90d
Author: Christine Poerschke <cpoerschke@apache.org>
Authored: Mon Jan 8 19:44:05 2018 +0000
Committer: Christine Poerschke <cpoerschke@apache.org>
Committed: Mon Jan 8 20:25:24 2018 +0000

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  5 +++
 .../solr/handler/component/QueryComponent.java  |  2 +-
 .../solr/search/TestReRankQParserPlugin.java    | 41 ++++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ec80a27/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 9888796..bcfacae 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -34,6 +34,11 @@ Bug Fixes
 
 * SOLR-11771: Overseer can never process some last messages (Cao Manh Dat)
 
+* SOLR-11809: QueryComponent.prepare rq parsing could fail under SOLR 7.2.0 - fix:
+  QueryComponent's rq parameter parsing no longer considers the defType parameter.
+  (Christine Poerschke and David Smiley in response to bug report/analysis
+  from Dariusz Wojtas and Diego Ceccarelli)
+
 ==================  7.2.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/2ec80a27/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index f27b386..ec3c79b 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -167,7 +167,7 @@ public class QueryComponent extends SearchComponent
 
       String rankQueryString = rb.req.getParams().get(CommonParams.RQ);
       if(rankQueryString != null) {
-        QParser rqparser = QParser.getParser(rankQueryString, defType, req);
+        QParser rqparser = QParser.getParser(rankQueryString, req);
         Query rq = rqparser.getQuery();
         if(rq instanceof RankQuery) {
           RankQuery rankQuery = (RankQuery)rq;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ec80a27/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java b/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java
index 0fd1a4a..93673d2 100644
--- a/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java
+++ b/solr/core/src/test/org/apache/solr/search/TestReRankQParserPlugin.java
@@ -605,4 +605,45 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
     }
   }
 
+  @Test
+  public void testReRankQueriesWithDefType() throws Exception {
+
+    assertU(delQ("*:*"));
+    assertU(commit());
+
+    final String[] doc1 = {"id","1"};
+    assertU(adoc(doc1));
+    assertU(commit());
+    final String[] doc2 = {"id","2"};
+    assertU(adoc(doc2));
+    assertU(commit());
+
+    final String preferredDocId;
+    final String lessPreferrredDocId;
+    if (random().nextBoolean()) {
+      preferredDocId = "1";
+      lessPreferrredDocId = "2";
+    } else {
+      preferredDocId = "2";
+      lessPreferrredDocId = "1";
+    }
+
+    for (final String defType : new String[] {
+        null,
+        LuceneQParserPlugin.NAME,
+        ExtendedDismaxQParserPlugin.NAME
+    }) {
+      final ModifiableSolrParams params = new ModifiableSolrParams();
+      params.add("rq", "{!"+ReRankQParserPlugin.NAME+" "+ReRankQParserPlugin.RERANK_QUERY+"=id:"+preferredDocId+"}");
+      params.add("q", "*:*");
+      if (defType != null) {
+        params.add(QueryParsing.DEFTYPE, defType);
+      }
+      assertQ(req(params), "*[count(//doc)=2]",
+          "//result/doc[1]/str[@name='id'][.='"+preferredDocId+"']",
+          "//result/doc[2]/str[@name='id'][.='"+lessPreferrredDocId+"']"
+      );
+    }
+  }
+
 }


Mime
View raw message