Pulkitg64 commented on code in PR #13401:
URL: https://github.com/apache/lucene/pull/13401#discussion_r1613025309


##########
lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90FieldInfosFormat.java:
##########
@@ -257,11 +269,12 @@ private static DocValuesType getDocValuesType(IndexInput 
input, byte b) throws I
     }
   }
 
-  private static VectorSimilarityFunction getDistFunc(IndexInput input, byte 
b) throws IOException {
-    if (b < 0 || b >= VectorSimilarityFunction.values().length) {
-      throw new CorruptIndexException("invalid distance function: " + b, 
input);
+  /** Returns VectorSimilarityFunction from index input and ordinal value */
+  public static VectorSimilarityFunction getDistFunc(IndexInput input, byte b) 
throws IOException {
+    if ((int) b < 0 || (int) b >= SIMILARITY_FUNCTIONS_MAP.size()) {
+      throw new CorruptIndexException("invalid distance function: " + (int) b, 
input);
     }
-    return VectorSimilarityFunction.values()[b];
+    return VectorSimilarityFunction.forName(SIMILARITY_FUNCTIONS_MAP.get((int) 
b));

Review Comment:
   Done



-- 
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