jpountz commented on a change in pull request #1789:
URL: https://github.com/apache/lucene-solr/pull/1789#discussion_r480385432



##########
File path: lucene/core/src/java/org/apache/lucene/index/SortingCodecReader.java
##########
@@ -1090,20 +1150,64 @@ public Bits getLiveDocs() {
   }
 
   @Override
-  public PointValues getPointValues(String fieldName) throws IOException {
-    final PointValues inPointValues = in.getPointValues(fieldName);
-    if (inPointValues == null) {
-      return null;
-    } else {
-      return new SortingPointValues(inPointValues, docMap);
-    }
+  public PointsReader getPointsReader() {
+    return new PointsReader() {
+      @Override
+      public void checkIntegrity() throws IOException {
+        in.getPointsReader().checkIntegrity();
+      }
+
+      @Override
+      public PointValues getValues(String field) throws IOException {
+        final PointValues inPointValues = in.getPointValues(field);
+        if (inPointValues == null) {
+          return null;
+        } else {
+          return new SortingPointValues(inPointValues, docMap);
+        }
+      }
+
+      @Override
+      public void close() throws IOException {
+        in.getPointsReader().close();
+      }
+
+      @Override
+      public long ramBytesUsed() {
+        return in.getPointsReader().ramBytesUsed();
+      }
+    };
   }
 
   private final Map<String,CachedNumericDVs> cachedNorms = new HashMap<>();
 
   @Override
-  public NumericDocValues getNormValues(String field) throws IOException {
-    final NumericDocValues oldNorms = in.getNormValues(field);
+  public NormsProducer getNormsReader() {
+    return new NormsProducer() {
+      @Override
+      public NumericDocValues getNorms(FieldInfo field) throws IOException {
+        final NumericDocValues oldNorms = in.getNormValues(field.name);

Review comment:
       likewise, delegate to in#getNormsReader here?

##########
File path: lucene/core/src/java/org/apache/lucene/index/SortingCodecReader.java
##########
@@ -1090,20 +1150,64 @@ public Bits getLiveDocs() {
   }
 
   @Override
-  public PointValues getPointValues(String fieldName) throws IOException {
-    final PointValues inPointValues = in.getPointValues(fieldName);
-    if (inPointValues == null) {
-      return null;
-    } else {
-      return new SortingPointValues(inPointValues, docMap);
-    }
+  public PointsReader getPointsReader() {
+    return new PointsReader() {
+      @Override
+      public void checkIntegrity() throws IOException {
+        in.getPointsReader().checkIntegrity();
+      }
+
+      @Override
+      public PointValues getValues(String field) throws IOException {
+        final PointValues inPointValues = in.getPointValues(field);

Review comment:
       IMO we should delegate to `in#getPointsReader()` as the contract is 
slightly different on the reader and the points reader (the reader returns null 
if the field was not indexed with points while the points reader fails).

##########
File path: lucene/core/src/java/org/apache/lucene/index/SortingCodecReader.java
##########
@@ -1090,20 +1150,64 @@ public Bits getLiveDocs() {
   }
 
   @Override
-  public PointValues getPointValues(String fieldName) throws IOException {
-    final PointValues inPointValues = in.getPointValues(fieldName);
-    if (inPointValues == null) {
-      return null;
-    } else {
-      return new SortingPointValues(inPointValues, docMap);
-    }
+  public PointsReader getPointsReader() {
+    return new PointsReader() {
+      @Override
+      public void checkIntegrity() throws IOException {
+        in.getPointsReader().checkIntegrity();
+      }
+
+      @Override
+      public PointValues getValues(String field) throws IOException {
+        final PointValues inPointValues = in.getPointValues(field);
+        if (inPointValues == null) {

Review comment:
       it can never be null since getValues may only be called on fields that 
were indexed with points on points readers




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to