zacharymorn commented on a change in pull request #534:
URL: https://github.com/apache/lucene/pull/534#discussion_r769243295



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/KnnVectorsWriter.java
##########
@@ -40,7 +41,8 @@
   protected KnnVectorsWriter() {}
 
   /** Write all values contained in the provided reader */
-  public abstract void writeField(FieldInfo fieldInfo, VectorValues values) 
throws IOException;
+  public abstract void writeField(FieldInfo fieldInfo, KnnVectorsReader 
knnVectorReader)

Review comment:
       Good suggestion! I've updated them to use `knnVectorsReader`. 

##########
File path: lucene/core/src/java/org/apache/lucene/index/VectorValuesWriter.java
##########
@@ -109,11 +110,15 @@ private void updateBytesUsed() {
   public void flush(Sorter.DocMap sortMap, KnnVectorsWriter knnVectorsWriter) 
throws IOException {
     VectorValues vectorValues =
         new BufferedVectorValues(docsWithField, vectors, 
fieldInfo.getVectorDimension());
-    if (sortMap != null) {
-      knnVectorsWriter.writeField(fieldInfo, new 
SortingVectorValues(vectorValues, sortMap));
-    } else {
-      knnVectorsWriter.writeField(fieldInfo, vectorValues);
-    }
+    KnnVectorsReader vectorsReader =
+        new EmptyKnnVectorsReader() {
+          @Override
+          public VectorValues getVectorValues(String field) throws IOException 
{
+            return sortMap != null ? new SortingVectorValues(vectorValues, 
sortMap) : vectorValues;

Review comment:
       Ops sorry good catch! I've fixed it. 




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