ChrisHegarty commented on code in PR #13570:
URL: https://github.com/apache/lucene/pull/13570#discussion_r1689527370


##########
lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java:
##########
@@ -83,6 +93,26 @@ public class MMapDirectory extends FSDirectory {
    */
   public static final BiPredicate<String, IOContext> NO_FILES = (filename, 
context) -> false;
 
+  /** Argument for {@link #setGroupingFunction(Function)} that configures no 
grouping. */
+  public static final Function<String, Optional<String>> NO_GROUPING = 
filename -> Optional.empty();
+
+  /** Argument for {@link #setGroupingFunction(Function)} that configures 
grouping by segment. */
+  public static final Function<String, Optional<String>> GROUP_BY_SEGMENT =
+      filename -> {
+        if (!CODEC_FILE_PATTERN.matcher(filename).matches()) {
+          return Optional.empty();
+        }
+        String groupKey = 
IndexFileNames.parseSegmentName(filename).substring(1);
+        try {

Review Comment:
   Yes, that's good. For the group key, we now append `-g` for all generation 
other than 0, and omit any suffix for invalid/0 generation. 



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

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