uschindler commented on code in PR #13570:
URL: https://github.com/apache/lucene/pull/13570#discussion_r1681847294
##########
lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java:
##########
@@ -83,6 +86,19 @@ 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 -> {
+ String segmentName = IndexFileNames.parseSegmentName(filename);
+ if (filename.length() == segmentName.length()) {
+ return Optional.empty();
+ }
+ return Optional.of(segmentName);
+ };
Review Comment:
Maybe add a method to validate and extract a segment name to
`IndexFileNames` class. We possibly also have one in test framework that could
be moved...
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]