dsmiley commented on code in PR #14433: URL: https://github.com/apache/lucene/pull/14433#discussion_r2034358885
########## 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: I should add the field name as an arg. The name is intentional -- if a Similarity can't decode the norm to a position length, it can throw `UnsupportedOperationException`. -- 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