mirror of https://github.com/apache/lucene.git
SOLR-5515: NPE when getting stats on date field with empty result on SolrCloud
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1546725 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
484c8e98bb
commit
655a12466f
|
@ -161,7 +161,10 @@ Bug Fixes
|
|||
a SolrCore does not exist in core discovery mode. (Mark Miller)
|
||||
|
||||
* SOLR-5354: Distributed sort is broken with CUSTOM FieldType.
|
||||
(Steve Rowe, hossman, Robert Muir, Jessica Cheng)
|
||||
(Steve Rowe, hossman, Robert Muir, Jessica Cheng)
|
||||
|
||||
* SOLR-5515: NPE when getting stats on date field with empty result on
|
||||
SolrCloud. (Alexander Sagen, shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -419,8 +419,11 @@ class DateStatsValues extends AbstractStatsValues<Date> {
|
|||
*/
|
||||
@Override
|
||||
protected void updateTypeSpecificStats(NamedList stv) {
|
||||
sum += ((Date) stv.get("sum")).getTime();
|
||||
sumOfSquares += ((Number)stv.get("sumOfSquares")).doubleValue();
|
||||
Date date = (Date) stv.get("sum");
|
||||
if (date != null) {
|
||||
sum += date.getTime();
|
||||
sumOfSquares += ((Number)stv.get("sumOfSquares")).doubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -398,6 +398,15 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
|
|||
// Thread.sleep(10000000000L);
|
||||
|
||||
FieldCache.DEFAULT.purgeAllCaches(); // avoid FC insanity
|
||||
|
||||
del("*:*"); // delete all docs and test stats request
|
||||
commit();
|
||||
try {
|
||||
query("q", "*:*", "stats", "true", "stats.field", "stats_dt", "stats.calcdistinct", "true");
|
||||
} catch (Exception e) {
|
||||
log.error("Exception on distrib stats request on empty index", e);
|
||||
fail("NullPointerException with stats request on empty index");
|
||||
}
|
||||
}
|
||||
|
||||
protected void queryPartialResults(final List<String> upShards,
|
||||
|
|
Loading…
Reference in New Issue