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/03/24 12:03:12 UTC

[GitHub] [lucene] mayya-sharipova commented on a change in pull request #32: LUCENE-9507 Custom order for leaves in IndexReader and IndexWriter

mayya-sharipova commented on a change in pull request #32:
URL: https://github.com/apache/lucene/pull/32#discussion_r600414533



##########
File path: lucene/core/src/java/org/apache/lucene/index/BaseCompositeReader.java
##########
@@ -231,4 +239,13 @@ protected final int readerBase(int readerIndex) {
   protected final List<? extends R> getSequentialSubReaders() {
     return subReadersList;
   }
+
+  /**
+   * Returns a comparator for sorting sub readers.
+   *
+   * @return a comparator for sorting sub readers, or {@code null} if a comparator was not set.
+   */
+  protected Comparator<R> getSubReadersSorter() {
+    return subReadersSorter;

Review comment:
       > .. if we wrap this reader in a FilterDirectoryReader, that wrapped reader will also sort its leaves the same way?
   
   Thank you , that's a very good point, you are right, indeed the wrapped reader will already sort its leaves the same way.  Fixed by removing `sorter` in `FilterDirectoryReader` in 34da11d80d30c1d4a418066edfadce0dde3379ae
   
   > .. why does the reader need to record its sorter? I guess maybe callers might want to "chain" the sorter -- have this reader remember what sorter was used, and on refresh, pull that sorter out and use it again for the next reader, ok.
   
   Right, indeed.  In `StandardDirectoryReader::doOpenIfChanged`, we reuse sorter.
   




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