lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject [30/50] lucene-solr:jira/solr-10990: SOLR-11322: omit val for min/max when no values in field for bucket
Date Wed, 06 Sep 2017 09:39:32 GMT
SOLR-11322: omit val for min/max when no values in field for bucket


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c6a5f10f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c6a5f10f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c6a5f10f

Branch: refs/heads/jira/solr-10990
Commit: c6a5f10fd364a0c63477348560e0c6eb1a742d3e
Parents: 33178fb
Author: yonik <yonik@apache.org>
Authored: Mon Sep 4 19:19:40 2017 -0400
Committer: yonik <yonik@apache.org>
Committed: Mon Sep 4 19:19:40 2017 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                          |  4 ++++
 .../src/java/org/apache/solr/search/facet/MinMaxAgg.java  | 10 ++++++++++
 .../test/org/apache/solr/search/facet/TestJsonFacets.java |  4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c6a5f10f/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 4ccc609..56b55c9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -183,6 +183,10 @@ Other Changes
 
 * SOLR-11209: Upgrade HttpClient to 4.5.3. (Hrishikesh Gadre via Mark Miller)
 
+* SOLR-11322: JSON Facet API: instead of returning NaN, min & max aggregations omit
+  the value for any bucket with no values in the numeric field. (yonik)
+
+
 ==================  7.0.0 ==================
 
 Versions of Major Components

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c6a5f10f/solr/core/src/java/org/apache/solr/search/facet/MinMaxAgg.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/facet/MinMaxAgg.java b/solr/core/src/java/org/apache/solr/search/facet/MinMaxAgg.java
index 9569599..0f4bea6 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/MinMaxAgg.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/MinMaxAgg.java
@@ -137,6 +137,16 @@ public class MinMaxAgg extends SimpleAggValueSource {
         result[slotNum] = val;
       }
     }
+
+    @Override
+    public Object getValue(int slot) {
+      double val = result[slot];
+      if (Double.isNaN(val)) {
+        return null;
+      } else {
+        return val;
+      }
+    }
   }
 
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c6a5f10f/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
index 3ee069f..5ecd3a1 100644
--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
@@ -1019,8 +1019,8 @@ public class TestJsonFacets extends SolrTestCaseHS {
             ",sum1:0.0," +
             " sumsq1:0.0," +
             " avg1:0.0," +   // TODO: undesirable. omit?
-            " min1:'NaN'," + // TODO: undesirable. omit?
-            " max1:'NaN'," +
+            // " min1:'NaN'," +
+            // " max1:'NaN'," +
             " numwhere:0," +
             " unique_num_i:0," +
             " unique_num_d:0," +


Mime
View raw message