shubhamvishu commented on code in PR #12548: URL: https://github.com/apache/lucene/pull/12548#discussion_r1342112773
########## lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java: ########## @@ -172,6 +173,40 @@ public LongValuesSource rewrite(IndexSearcher searcher) throws IOException { } } + /** + * Returns a DoubleValues instance for computing the vector similarity score per document against + * the byte query vector + * + * @param ctx the context for which to return the DoubleValues + * @param queryVector byte query vector + * @param vectorField knn byte field name + * @return DoubleValues instance + * @throws IOException if an {@link IOException} occurs + */ + public static DoubleValues similarityToQueryVector( + LeafReaderContext ctx, byte[] queryVector, String vectorField) throws IOException { + assert ctx.reader().getFieldInfos().fieldInfo(vectorField).getVectorEncoding() Review Comment: Makes sense! But I wonder if thats the case in many places in codebase?. I think we should rather throw an `IAE` in this case. -- 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