SOLR-5690: Fix NPE in AbstractStatsValues.accumulate with docValues and docs with empty field

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1565106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-02-06 08:21:56 +00:00
parent 95610a8c58
commit 462131403a
2 changed files with 6 additions and 2 deletions

View File

@ -100,7 +100,7 @@ New Features
* SOLR-5208: Support for the setting of core.properties key/values at create-time on
Collections API (Erick Erickson)
* SOLR-5428: New 'stats.calcdistinct' parameter in StatsComponent returns
* SOLR-5428: SOLR-5690: New 'stats.calcdistinct' parameter in StatsComponent returns
set of distinct values and their count. This can also be specified per field
e.g. 'f.field.stats.calcdistinct'. (Elran Dvir via shalin)

View File

@ -494,7 +494,11 @@ class StringStatsValues extends AbstractStatsValues<String> {
@Override
public void accumulate(int docID) {
if (values.exists(docID)) {
accumulate(values.strVal(docID), 1);
String value = values.strVal(docID);
if (value != null)
accumulate(value, 1);
else
missing();
} else {
missing();
}