You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/04/26 08:03:03 UTC

[GitHub] [lucene] jpountz commented on a change in pull request #104: LUCENE-9908: Move VectorValues#search to LeafReader

jpountz commented on a change in pull request #104:
URL: https://github.com/apache/lucene/pull/104#discussion_r620057599



##########
File path: lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
##########
@@ -1357,6 +1359,11 @@ public VectorValues getVectorValues(String fieldName) {
       return VectorValues.EMPTY;
     }
 
+    @Override
+    public TopDocs searchNearestVectors(String field, float[] target, int k, int fanout) {
+      return TopDocsCollector.EMPTY_TOPDOCS;

Review comment:
       Should it be `null`? My understanding based on the rest of the PR is that we use `null` when a field doesn't have vectors and `EMPTY_TOP_DOCS` when a field has vectors but not on the current segment. Since MemoryIndex doesn't support indexing vectors should it return null?

##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90VectorReader.java
##########
@@ -199,40 +229,53 @@ public void checkIntegrity() throws IOException {
 
   @Override
   public VectorValues getVectorValues(String field) throws IOException {
-    FieldInfo info = fieldInfos.fieldInfo(field);
-    if (info == null) {
+    FieldEntry fieldEntry = fields.get(field);

Review comment:
       Ideally we'd be consistent with what we do with doc values:
    - The low-level API on `VectorReader` only supports getting data for fields that exist and have vectors enabled on their FieldInfo, the behavior is undefined otherwise.
    - The high-level API on `LeafReader` checks the FieldInfo and returns `null` for fields that do not exist or that don't have vectors enabled, and otherwise delegates to the `VectorReader`.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org