Skip to content

Apache Lucene open-source search software

LUCENE-2286: enable DefaultSimilarity.setDiscountOverlaps by default

Robert Muirf447adb54936
diff --git a/CHANGES.txt b/CHANGES.txt
index dce16951d62..a93eb415903 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -22,6 +22,10 @@ Changes in backwards compatibility policy
* LUCENE-2190: Removed deprecated customScore() and customExplain()
methods from experimental CustomScoreQuery. (Uwe Schindler)
+
+* LUCENE-2286: Enabled DefaultSimilarity.setDiscountOverlaps by default.
+ This means that terms with a position increment gap of zero do not
+ affect the norms calculation by default. (Robert Muir)
Changes in runtime behavior
diff --git a/src/java/org/apache/lucene/search/DefaultSimilarity.java b/src/java/org/apache/lucene/search/DefaultSimilarity.java
index 40b53b47c24..0ab551ad8b2 100644
--- a/src/java/org/apache/lucene/search/DefaultSimilarity.java
+++ b/src/java/org/apache/lucene/search/DefaultSimilarity.java
@@ -76,13 +76,13 @@ public class DefaultSimilarity extends Similarity {
return overlap / (float)maxOverlap;
}
- // Default false
- protected boolean discountOverlaps;
+ // Default true
+ protected boolean discountOverlaps = true;
/** Determines whether overlap tokens (Tokens with
* 0 position increment) are ignored when computing
- * norm. By default this is false, meaning overlap
- * tokens are counted just like non-overlap tokens.
+ * norm. By default this is true, meaning overlap
+ * tokens do not count when computing norms.
*
* @lucene.experimental
*