hossman commented on PR #13162:
URL: https://github.com/apache/lucene/pull/13162#issuecomment-2010107912

   FWIW: This commit seems to have duplicated `checkField` logic that was 
previously added in #13105 -- compare `VectorFieldFunction.checkField` with 
`FloatVectorValues.checkField` and `ByteVectorValues.checkField`.
   
   These should probably be refactored to eliminate the duplication?
   
   ```
   hossman@slate:~/lucene/lucene [j11] [main] $ tail -20 
./lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/VectorFieldFunction.java
      * @lucene.internal
      * @lucene.experimental
      */
     static void checkField(LeafReader in, String field, VectorEncoding 
expectedEncoding) {
       FieldInfo fi = in.getFieldInfos().fieldInfo(field);
       if (fi != null) {
         final VectorEncoding actual = fi.hasVectorValues() ? 
fi.getVectorEncoding() : null;
         if (expectedEncoding != actual) {
           throw new IllegalStateException(
               "Unexpected vector encoding ("
                   + actual
                   + ") for field "
                   + field
                   + "(expected="
                   + expectedEncoding
                   + ")");
         }
       }
     }
   }
   hossman@slate:~/lucene/lucene [j11] [main] $ tail -20 
./lucene/core/src/java/org/apache/lucene/index/FloatVectorValues.java
      * Checks the Vector Encoding of a field
      *
      * @throws IllegalStateException if {@code field} has vectors, but using a 
different encoding
      * @lucene.internal
      * @lucene.experimental
      */
     public static void checkField(LeafReader in, String field) {
       FieldInfo fi = in.getFieldInfos().fieldInfo(field);
       if (fi != null && fi.hasVectorValues() && fi.getVectorEncoding() != 
VectorEncoding.FLOAT32) {
         throw new IllegalStateException(
             "Unexpected vector encoding ("
                 + fi.getVectorEncoding()
                 + ") for field "
                 + field
                 + "(expected="
                 + VectorEncoding.FLOAT32
                 + ")");
       }
     }
   }
   
   ```
   


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