mirror of https://github.com/apache/lucene.git
SOLR-5204: StatsComponent and SpellCheckComponent do not support the shards.tolerant=true parameter
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546819 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1e26cb20ba
commit
f56bf5b9d0
|
@ -169,6 +169,9 @@ Bug Fixes
|
|||
* SOLR-5515: NPE when getting stats on date field with empty result on
|
||||
SolrCloud. (Alexander Sagen, shalin)
|
||||
|
||||
* SOLR-5204: StatsComponent and SpellCheckComponent do not support the
|
||||
shards.tolerant=true parameter. (Anca Kopetz, shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -320,7 +320,16 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
|
|||
if (maxResultsForSuggest==null || !isCorrectlySpelled) {
|
||||
for (ShardRequest sreq : rb.finished) {
|
||||
for (ShardResponse srsp : sreq.responses) {
|
||||
NamedList nl = (NamedList) srsp.getSolrResponse().getResponse().get("spellcheck");
|
||||
NamedList nl = null;
|
||||
try {
|
||||
nl = (NamedList) srsp.getSolrResponse().getResponse().get("spellcheck");
|
||||
} catch (Exception e) {
|
||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false)) {
|
||||
continue; // looks like a shard did not return anything
|
||||
}
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Unable to read spelling info for shard: " + srsp.getShard(), e);
|
||||
}
|
||||
LOG.info(srsp.getShard() + " " + nl);
|
||||
if (nl != null) {
|
||||
mergeData.totalNumberShardResponses++;
|
||||
|
|
|
@ -102,7 +102,16 @@ public class StatsComponent extends SearchComponent {
|
|||
StatsInfo si = rb._statsInfo;
|
||||
|
||||
for (ShardResponse srsp : sreq.responses) {
|
||||
NamedList stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");
|
||||
NamedList stats = null;
|
||||
try {
|
||||
stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");
|
||||
} catch (Exception e) {
|
||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false)) {
|
||||
continue; // looks like a shard did not return anything
|
||||
}
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Unable to read stats info for shard: " + srsp.getShard(), e);
|
||||
}
|
||||
|
||||
NamedList stats_fields = (NamedList) stats.get("stats_fields");
|
||||
if (stats_fields != null) {
|
||||
|
|
|
@ -105,6 +105,8 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
t1,"no eggs on wall, lesson learned",
|
||||
oddField, "odd man out");
|
||||
|
||||
indexr(id, "1001", "lowerfilt", "toyota"); // for spellcheck
|
||||
|
||||
indexr(id, 14, "SubjectTerms_mfacet", new String[] {"mathematical models", "mathematical analysis"});
|
||||
indexr(id, 15, "SubjectTerms_mfacet", new String[] {"test 1", "test 2", "test3"});
|
||||
indexr(id, 16, "SubjectTerms_mfacet", new String[] {"test 1", "test 2", "test3"});
|
||||
|
@ -227,6 +229,9 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
query("q","*:*", "fl", "id", "fl",nint, "fl",tint,"sort",i1 + " desc");
|
||||
query("q","*:*", "fl",nint, "fl", "id", "fl",tint,"sort",i1 + " desc");
|
||||
|
||||
// basic spellcheck testing
|
||||
query("q", "toyata", "fl", "id,lowerfilt", "spellcheck", true, "spellcheck.q", "toyata", "qt", "spellCheckCompRH_Direct", "shards.qt", "spellCheckCompRH_Direct");
|
||||
|
||||
stress=0; // turn off stress... we want to tex max combos in min time
|
||||
for (int i=0; i<25*RANDOM_MULTIPLIER; i++) {
|
||||
String f = fieldNames[random().nextInt(fieldNames.length)];
|
||||
|
@ -383,6 +388,22 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
ShardParams.SHARDS_INFO, "true",
|
||||
ShardParams.SHARDS_TOLERANT, "true");
|
||||
|
||||
queryPartialResults(upShards, upClients,
|
||||
"q", "*:*",
|
||||
"stats", "true",
|
||||
"stats.field", i1,
|
||||
ShardParams.SHARDS_INFO, "true",
|
||||
ShardParams.SHARDS_TOLERANT, "true");
|
||||
|
||||
queryPartialResults(upShards, upClients,
|
||||
"q", "toyata",
|
||||
"spellcheck", "true",
|
||||
"spellcheck.q", "toyata",
|
||||
"qt", "spellCheckCompRH_Direct",
|
||||
"shards.qt", "spellCheckCompRH_Direct",
|
||||
ShardParams.SHARDS_INFO, "true",
|
||||
ShardParams.SHARDS_TOLERANT, "true");
|
||||
|
||||
// restart the jettys
|
||||
for (JettySolrRunner downJetty : downJettys) {
|
||||
downJetty.start();
|
||||
|
|
Loading…
Reference in New Issue