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



##########
File path: 
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
##########
@@ -39,33 +40,44 @@
 
   final IndexWriter writer;
   final SegmentInfos segmentInfos;
+  private final Comparator<LeafReader> leafSorter;
   private final boolean applyAllDeletes;
   private final boolean writeAllDeletes;
 
-  /** called only from static open() methods */
+  /**
+   * package private constructor, called only from static open() methods. If 
parameter {@code
+   * leafSorter} is not {@code null}, the provided {@code readers} are 
expected to be already sorted

Review comment:
       Great suggestion! I moved sorting of leaves to the constructor. 
   Addressed in 8155f2e2abd4ed3a6280aae940d018dfe3b3dad1.

##########
File path: 
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
##########
@@ -143,12 +158,17 @@ static StandardDirectoryReader open(
 
       writer.incRefDeleter(segmentInfos);
 
+      if (writer.getConfig().getLeafSorter() != null) {
+        readers.sort(writer.getConfig().getLeafSorter());

Review comment:
       @mikemccand  Thank you for your feedback.
   The intent was to keep `leafSorter` constant and non-updatable, as  
`indexWriter.getConfig` returns `LiveIndexWriterConfig` that doesn't allow 
setting of a new `leafSorter`. I understand that `leafSorter` in config can 
still be changed, and your comment is very valid. 
   
   But In 8155f2e2abd4ed3a6280aae940d018dfe3b3dad1  I've moved sorting of 
leaves to the constructor, so hopefully this should resolve this concern. 

##########
File path: 
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
##########
@@ -169,7 +189,10 @@ static StandardDirectoryReader open(
    * @lucene.internal
    */
   public static DirectoryReader open(
-      Directory directory, SegmentInfos infos, List<? extends LeafReader> 
oldReaders)
+      Directory directory,

Review comment:
       It looks like  `IndexWriter.getReader(...)` path is covered by a 
previous `open` method on line 123.




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