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


##########
lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/ConstKnnFloat16ValueSource.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.queries.function.valuesource;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Objects;
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.queries.function.FunctionValues;
+import org.apache.lucene.queries.function.ValueSource;
+
+/** Function that returns a constant float16 vector value for every document. 
*/
+public class ConstKnnFloat16ValueSource extends ValueSource {
+  private final short[] vector;
+
+  public ConstKnnFloat16ValueSource(short[] constVector) {
+    this.vector = Objects.requireNonNull(constVector, "constVector");
+  }
+
+  @Override
+  public FunctionValues getValues(Map<Object, Object> context, 
LeafReaderContext readerContext)

Review Comment:
   > do we really need these float16 values sources? 
   
   This was needed just for benchmark support in lucene util for exact scoring 
path(example ref: 
[link](https://github.com/mikemccand/luceneutil/blob/main/src/main/knn/KnnGraphTester.java#L2174)).
 This is not needed in production path. Should we remove this change to make PR 
more simpler? 
   
   
   > I wonder if we could use Float valuesSources over float16 vector fields?
   
   I think we can do that and drop the ConstKnnFloat16ValueSource completely. 
It's just there to be consistent with other classes ConstKnnFloatValueSource 
and ConstKnnByteValueSource. But I don't have any strong opinion on this. 
Should we drop this??



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