mirror of https://github.com/apache/lucene.git
SOLR-6311: SearchHandler should use path when no qt or shard.qt parameter is specified
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1659694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04e297adee
commit
e7ebd44f12
|
@ -155,6 +155,10 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-7103: Remove unused method params in faceting code. (shalin)
|
* SOLR-7103: Remove unused method params in faceting code. (shalin)
|
||||||
|
|
||||||
|
* SOLR-6311: When performing distributed queries, SearchHandler should use path
|
||||||
|
when no qt or shard.qt parameter is specified; fix also resolves SOLR-4479.
|
||||||
|
(Steve Molloy, Timothy Potter)
|
||||||
|
|
||||||
================== 5.0.0 ==================
|
================== 5.0.0 ==================
|
||||||
|
|
||||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.solr.handler.component;
|
package org.apache.solr.handler.component;
|
||||||
|
|
||||||
import org.apache.lucene.index.ExitableDirectoryReader;
|
import org.apache.lucene.index.ExitableDirectoryReader;
|
||||||
|
import org.apache.lucene.util.Version;
|
||||||
import org.apache.solr.client.solrj.SolrServerException;
|
import org.apache.solr.client.solrj.SolrServerException;
|
||||||
import org.apache.solr.common.SolrDocumentList;
|
import org.apache.solr.common.SolrDocumentList;
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
|
@ -306,10 +307,21 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware ,
|
||||||
params.set("NOW", Long.toString(rb.requestInfo.getNOW().getTime()));
|
params.set("NOW", Long.toString(rb.requestInfo.getNOW().getTime()));
|
||||||
}
|
}
|
||||||
String shardQt = params.get(ShardParams.SHARDS_QT);
|
String shardQt = params.get(ShardParams.SHARDS_QT);
|
||||||
if (shardQt == null) {
|
if (shardQt != null) {
|
||||||
params.remove(CommonParams.QT);
|
|
||||||
} else {
|
|
||||||
params.set(CommonParams.QT, shardQt);
|
params.set(CommonParams.QT, shardQt);
|
||||||
|
} else {
|
||||||
|
// for distributed queries that don't include shards.qt, use the original path
|
||||||
|
// as the default but operators need to update their luceneMatchVersion to enable
|
||||||
|
// this behavior since it did not work this way prior to 5.1
|
||||||
|
if (req.getCore().getSolrConfig().luceneMatchVersion.onOrAfter(Version.LUCENE_5_1_0)) {
|
||||||
|
String reqPath = (String)req.getContext().get("path");
|
||||||
|
if (!"/select".equals(reqPath)) {
|
||||||
|
params.set(CommonParams.QT, reqPath);
|
||||||
|
} // else if path is /select, then the qt gets passed thru if set
|
||||||
|
} else {
|
||||||
|
// this is the pre-5.1 behavior, which translates to sending the shard request to /select
|
||||||
|
params.remove(CommonParams.QT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shardHandler1.submit(sreq, shard, params);
|
shardHandler1.submit(sreq, shard, params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,10 +123,8 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
final String tv = "tvrh";
|
final String tv = "tvrh";
|
||||||
|
|
||||||
for (String q : new String[] {"id:0", "id:7", "id:[3 TO 6]", "*:*"}) {
|
for (String q : new String[] {"id:0", "id:7", "id:[3 TO 6]", "*:*"}) {
|
||||||
|
|
||||||
query("sort","id desc",
|
query("sort","id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
TermVectorParams.TF, "true");
|
TermVectorParams.TF, "true");
|
||||||
|
@ -134,7 +132,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
// tv.fl diff from fl
|
// tv.fl diff from fl
|
||||||
query("sort", "id asc",
|
query("sort", "id asc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
"fl", "*,score",
|
"fl", "*,score",
|
||||||
"tv.fl", "test_basictv,test_offtv",
|
"tv.fl", "test_basictv,test_offtv",
|
||||||
|
@ -144,7 +141,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
// multi-valued tv.fl
|
// multi-valued tv.fl
|
||||||
query("sort", "id asc",
|
query("sort", "id asc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
"fl", "*,score",
|
"fl", "*,score",
|
||||||
"tv.fl", "test_basictv",
|
"tv.fl", "test_basictv",
|
||||||
|
@ -154,7 +150,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
// re-use fl glob
|
// re-use fl glob
|
||||||
query("sort", "id desc",
|
query("sort", "id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
"fl", "*,score",
|
"fl", "*,score",
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
|
@ -162,7 +157,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
// re-use fl, ignore things we can't handle
|
// re-use fl, ignore things we can't handle
|
||||||
query("sort", "id desc",
|
query("sort", "id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
"fl", "score,test_basictv,[docid],test_postv,val:sum(3,4)",
|
"fl", "score,test_basictv,[docid],test_postv,val:sum(3,4)",
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
|
@ -171,7 +165,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
// re-use (multi-valued) fl, ignore things we can't handle
|
// re-use (multi-valued) fl, ignore things we can't handle
|
||||||
query("sort", "id desc",
|
query("sort", "id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
"fl", "score,test_basictv",
|
"fl", "score,test_basictv",
|
||||||
"fl", "[docid],test_postv,val:sum(3,4)",
|
"fl", "[docid],test_postv,val:sum(3,4)",
|
||||||
|
@ -182,7 +175,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
|
|
||||||
query("sort", "id asc",
|
query("sort", "id asc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
TermVectorParams.TF, "true",
|
TermVectorParams.TF, "true",
|
||||||
|
@ -193,7 +185,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
|
|
||||||
query("sort", "id desc",
|
query("sort", "id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
TermVectorParams.ALL, "true");
|
TermVectorParams.ALL, "true");
|
||||||
|
@ -202,7 +193,6 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
|
||||||
|
|
||||||
query("sort", "id desc",
|
query("sort", "id desc",
|
||||||
"qt",tv,
|
"qt",tv,
|
||||||
"shards.qt",tv,
|
|
||||||
"q", q,
|
"q", q,
|
||||||
TermVectorComponent.COMPONENT_NAME, "true",
|
TermVectorComponent.COMPONENT_NAME, "true",
|
||||||
TermVectorParams.TF, "true",
|
TermVectorParams.TF, "true",
|
||||||
|
|
Loading…
Reference in New Issue