rmuir commented on code in PR #15818:
URL: https://github.com/apache/lucene/pull/15818#discussion_r2984760358


##########
lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java:
##########
@@ -95,7 +114,20 @@ public BM25Similarity(boolean discountOverlaps) {
    * </ul>
    */
   public BM25Similarity() {
-    this(1.2f, 0.75f, true);
+    this(1.2f, 0.75f, true, -1f);
+  }
+
+  /**
+   * Computes the query-term weight using BM25's k3 saturation formula: ((k3 + 
1) * qtf) / (k3 +
+   * qtf). When k3 is negative (disabled), falls back to linear weighting 
where the weight equals
+   * the query term frequency.
+   */
+  @Override
+  public float computeQueryTermWeight(int queryTermFrequency) {
+    if (k3 < 0) {
+      return (float) queryTermFrequency;
+    }

Review Comment:
   I like how the qtf is integrated into the Similarity here. I guess this 
special `-1` handling is the only messy part but I can't offer any better 
solution.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to