You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/01/11 08:01:01 UTC
[25/50] [abbrv] lucene-solr:jira/solr-11702: 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 respon
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/28286568
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/28286568
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/28286568
Branch: refs/heads/jira/solr-11702
Commit: 2828656892114ab7bb4c7742eac9c4e6f49f69ab
Parents: a9fec9b
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Jan 8 19:44:05 2018 +0000
Committer: Christine Poerschke <cp...@apache.org>
Committed: Mon Jan 8 19:44:05 2018 +0000
----------------------------------------------------------------------
solr/CHANGES.txt | 7 ++++
.../solr/handler/component/QueryComponent.java | 2 +-
.../solr/search/TestReRankQParserPlugin.java | 41 ++++++++++++++++++++
3 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/28286568/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 011766f..31197a0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -60,6 +60,8 @@ Upgrade Notes
* SOLR-11798: The top-level <highlighting> syntax in solrconfig.xml is now formally
deprecated in favour of <searchComponent> equivalent syntax. See also SOLR-1696.
+* SOLR-11809: QueryComponent's rq parameter parsing no longer considers the defType parameter.
+
New Features
----------------------
* SOLR-11285: Simulation framework for autoscaling. (ab)
@@ -131,6 +133,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/28286568/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 7dbd311..71ac9c0 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/28286568/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+"']"
+ );
+ }
+ }
+
}