msokolov commented on code in PR #12548: URL: https://github.com/apache/lucene/pull/12548#discussion_r1357027508
########## lucene/core/src/java/org/apache/lucene/search/DoubleValuesSource.java: ########## @@ -172,6 +173,52 @@ 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( Review Comment: Let's move these to VectorSimilaritySource? This file seem to be a dumping ground for all the things; let's not pile on. ########## lucene/core/src/java/org/apache/lucene/search/ByteVectorSimilarityValuesSource.java: ########## @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.lucene.search; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; +import org.apache.lucene.index.ByteVectorValues; +import org.apache.lucene.index.LeafReaderContext; +import org.apache.lucene.index.VectorSimilarityFunction; + +/** + * A {@link DoubleValuesSource} which computes the vector similarity scores between the query vector Review Comment: nit: my English profs always said to use "that" in place of "which" when possible -- 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