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


##########
lucene/core/src/java/org/apache/lucene/search/similarities/Similarity.java:
##########
@@ -161,6 +162,17 @@ public long computeNorm(FieldInvertState state) {
     return SmallFloat.intToByte4(numTerms);
   }
 
+  /**
+   * Decodes the normalization value as computed by {@link 
#computeNorm(FieldInvertState)}, yielding
+   * the field's position length.
+   *
+   * @param norm from {@link 
org.apache.lucene.index.NumericDocValues#longValue()} of the norm.
+   * @return position length
+   */
+  public long decodeNormToLength(long norm) {
+    return SmallFloat.byte4ToInt((byte) norm);
+  }

Review Comment:
   Also the name is wrong, there's nothing that requires this to be a position 
length. For some scoring methods it is something else such as the number of 
unique terms.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to