diff --git a/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java b/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java index e93a074616c..cb51596a5ad 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java @@ -637,8 +637,8 @@ public final class MoreLikeThis { for (Map.Entry tfEntry : perWordTermFrequencies.entrySet()) { // for every word String word = tfEntry.getKey(); - int tf = tfEntry.getValue().x; // term freq in the source doc - if (minTermFreq > 0 && tf < minTermFreq) { + int termFreq = tfEntry.getValue().x; // term freq in the source doc + if (minTermFreq > 0 && termFreq < minTermFreq) { continue; // filter out words that don't occur enough times in the source } @@ -656,6 +656,7 @@ public final class MoreLikeThis { continue; // index update problem? } + float tf = similarity.tf(termFreq); float idf = similarity.idf(docFreq, numDocs); float score = tf * idf;