mirror of https://github.com/apache/lucene.git
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)
This commit is contained in:
parent
a9fec9bf7c
commit
2828656892
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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+"']"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue