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 2022/09/20 08:33:42 UTC

[GitHub] [lucene] jpountz commented on a diff in pull request #11793: Prevent PointValues from returning null for ghost fields

jpountz commented on code in PR #11793:
URL: https://github.com/apache/lucene/pull/11793#discussion_r975049657


##########
lucene/core/src/java/org/apache/lucene/index/PointValues.java:
##########
@@ -467,4 +467,91 @@ public final long estimateDocCount(IntersectVisitor visitor) {
 
   /** Returns the total number of documents that have indexed at least one point. */
   public abstract int getDocCount();
+
+  private static final PointTree EMPTY_POINT_TREE =
+      new PointTree() {
+        @Override
+        public PointTree clone() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean moveToChild() {
+          return false;
+        }
+
+        @Override
+        public boolean moveToSibling() {
+          return false;
+        }
+
+        @Override
+        public boolean moveToParent() {
+          return false;
+        }
+
+        @Override
+        public byte[] getMinPackedValue() {
+          return new byte[0];
+        }
+
+        @Override
+        public byte[] getMaxPackedValue() {
+          return new byte[0];
+        }
+
+        @Override
+        public long size() {
+          return 0;
+        }
+
+        @Override
+        public void visitDocIDs(IntersectVisitor visitor) {}
+
+        @Override
+        public void visitDocValues(IntersectVisitor visitor) {}
+      };
+
+  public static final PointValues EMPTY =

Review Comment:
   One issue that the other PR regarding ghost fields and terms highlighted is that we should tune this empty instance so that it returns correct values for field metadata such as numbers of dimensions. Otherwise any code that would be checking the number of dimensions via this empty instance could be retrieving wrong numbers. See e.g. `checkValidPointValues` in `PointRangeQuery`.



-- 
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-unsubscribe@lucene.apache.org

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