You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ma...@apache.org on 2022/04/21 20:39:40 UTC

[solr] branch branch_9x updated: SOLR-16144: In RelatednessAgg, don't internally round fg/bg_pop (#790)

This is an automated email from the ASF dual-hosted git repository.

magibney pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new b12a0cae158 SOLR-16144: In RelatednessAgg, don't internally round fg/bg_pop (#790)
b12a0cae158 is described below

commit b12a0cae158eae641490932dd8dde03ef360819a
Author: Michael Gibney <mi...@michaelgibney.net>
AuthorDate: Thu Apr 21 15:57:52 2022 -0400

    SOLR-16144: In RelatednessAgg, don't internally round fg/bg_pop (#790)
    
    (cherry picked from commit f17051b69f5dbda811240c8f7d0e3740b53e5428)
---
 .../java/org/apache/solr/search/facet/RelatednessAgg.java  | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java b/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
index 783554587f2..e8c24112fba 100644
--- a/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
+++ b/solr/core/src/java/org/apache/solr/search/facet/RelatednessAgg.java
@@ -531,11 +531,10 @@ public class RelatednessAgg extends AggValueSource {
         long fg_count, long fg_size, long bg_count, long bg_size, double relatedness) {
       this.fg_count = fg_count;
       this.fg_size = fg_size;
-      this.fg_pop =
-          roundTo5Digits((double) fg_count / bg_size); // yes, BACKGROUND size is intentional
+      this.fg_pop = (double) fg_count / bg_size; // yes, BACKGROUND size is intentional
       this.bg_count = bg_count;
       this.bg_size = bg_size;
-      this.bg_pop = roundTo5Digits((double) bg_count / bg_size);
+      this.bg_pop = (double) bg_count / bg_size;
       this.relatedness = relatedness;
     }
 
@@ -589,9 +588,8 @@ public class RelatednessAgg extends AggValueSource {
         return; // values already computed;
       }
 
-      this.fg_pop =
-          roundTo5Digits((double) fg_count / bg_size); // yes, BACKGROUND size is intentional
-      this.bg_pop = roundTo5Digits((double) bg_count / bg_size);
+      this.fg_pop = (double) fg_count / bg_size; // yes, BACKGROUND size is intentional
+      this.bg_pop = (double) bg_count / bg_size;
 
       if (0.0D < agg.min_pop) {
         // if min_pop is configured, and either (fg|bg) popularity is lower then that value
@@ -680,8 +678,8 @@ public class RelatednessAgg extends AggValueSource {
         // there's no need to bother computing these when returning results *to* a shard coordinator
         // only useful to external clients
         result.add(RELATEDNESS, this.getRelatedness());
-        result.add(FG_POP, this.getForegroundPopularity());
-        result.add(BG_POP, this.getBackgroundPopularity());
+        result.add(FG_POP, roundTo5Digits(this.getForegroundPopularity()));
+        result.add(BG_POP, roundTo5Digits(this.getBackgroundPopularity()));
       }
 
       return result;