From e56b279624453cc6a29c7ef4fbcaa1fb70634c4c Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Thu, 24 Jan 2013 21:52:56 +0100 Subject: [PATCH] Made BlockJoinScorer#freq() method handle freqs correctly (as is done in ToParentBlockJoinQuery) --- .../elasticsearch/index/search/nested/BlockJoinQuery.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/search/nested/BlockJoinQuery.java b/src/main/java/org/elasticsearch/index/search/nested/BlockJoinQuery.java index eebf83cae46..9417f644a36 100644 --- a/src/main/java/org/elasticsearch/index/search/nested/BlockJoinQuery.java +++ b/src/main/java/org/elasticsearch/index/search/nested/BlockJoinQuery.java @@ -295,11 +295,11 @@ public class BlockJoinQuery extends Query { } int totalScore = 0; - int totalFreq = 0; float maxScore = Float.NEGATIVE_INFINITY; int maxFreq = 0; childDocUpto = 0; + parentFreq = 0; do { //System.out.println(" c=" + nextChildDoc); @@ -318,7 +318,7 @@ public class BlockJoinQuery extends Query { maxScore = Math.max(childScore, maxScore); maxFreq = Math.max(childFreq, maxFreq); totalScore += childScore; - totalFreq += childFreq; + parentFreq += childFreq; } // CHANGE: @@ -334,15 +334,12 @@ public class BlockJoinQuery extends Query { switch (scoreMode) { case Avg: parentScore = totalScore / childDocUpto; - parentFreq = totalFreq / childDocUpto; break; case Max: parentScore = maxScore; - parentFreq = maxFreq; break; case Total: parentScore = totalScore; - parentFreq = totalFreq; break; case None: break;