LUCENE-7991: KNearestNeighborDocumentClassifier.knnSearch no longer applies a previous boosted field's factor to subsequent unboosted fields.

This commit is contained in:
Christine Poerschke 2017-10-18 13:18:40 +01:00
parent a6f8dd74f0
commit 6aa312a8db
2 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,12 @@ Changes in Runtime Behavior
======================= Lucene 7.2.0 =======================
(No Changes)
Bug Fixes
* LUCENE-7991: KNearestNeighborDocumentClassifier.knnSearch no longer applies
a previous boosted field's factor to subsequent unboosted fields.
(Christine Poerschke)
======================= Lucene 7.1.0 =======================

View File

@ -129,6 +129,7 @@ public class KNearestNeighborDocumentClassifier extends KNearestNeighborClassifi
for (String fieldContent : fieldValues) {
mltQuery.add(new BooleanClause(mlt.like(fieldName, new StringReader(fieldContent)), BooleanClause.Occur.SHOULD));
}
mlt.setBoostFactor(1);// restore neutral boost for next field
}
Query classFieldQuery = new WildcardQuery(new Term(classFieldName, "*"));
mltQuery.add(new BooleanClause(classFieldQuery, BooleanClause.Occur.MUST));