Made BlockJoinScorer#freq() method handle freqs correctly (as is done in ToParentBlockJoinQuery)
This commit is contained in:
parent
9013eeae8a
commit
e56b279624
|
@ -295,11 +295,11 @@ public class BlockJoinQuery extends Query {
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalScore = 0;
|
int totalScore = 0;
|
||||||
int totalFreq = 0;
|
|
||||||
float maxScore = Float.NEGATIVE_INFINITY;
|
float maxScore = Float.NEGATIVE_INFINITY;
|
||||||
int maxFreq = 0;
|
int maxFreq = 0;
|
||||||
|
|
||||||
childDocUpto = 0;
|
childDocUpto = 0;
|
||||||
|
parentFreq = 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
//System.out.println(" c=" + nextChildDoc);
|
//System.out.println(" c=" + nextChildDoc);
|
||||||
|
@ -318,7 +318,7 @@ public class BlockJoinQuery extends Query {
|
||||||
maxScore = Math.max(childScore, maxScore);
|
maxScore = Math.max(childScore, maxScore);
|
||||||
maxFreq = Math.max(childFreq, maxFreq);
|
maxFreq = Math.max(childFreq, maxFreq);
|
||||||
totalScore += childScore;
|
totalScore += childScore;
|
||||||
totalFreq += childFreq;
|
parentFreq += childFreq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHANGE:
|
// CHANGE:
|
||||||
|
@ -334,15 +334,12 @@ public class BlockJoinQuery extends Query {
|
||||||
switch (scoreMode) {
|
switch (scoreMode) {
|
||||||
case Avg:
|
case Avg:
|
||||||
parentScore = totalScore / childDocUpto;
|
parentScore = totalScore / childDocUpto;
|
||||||
parentFreq = totalFreq / childDocUpto;
|
|
||||||
break;
|
break;
|
||||||
case Max:
|
case Max:
|
||||||
parentScore = maxScore;
|
parentScore = maxScore;
|
||||||
parentFreq = maxFreq;
|
|
||||||
break;
|
break;
|
||||||
case Total:
|
case Total:
|
||||||
parentScore = totalScore;
|
parentScore = totalScore;
|
||||||
parentFreq = totalFreq;
|
|
||||||
break;
|
break;
|
||||||
case None:
|
case None:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue