javanna commented on code in PR #13542:
URL: https://github.com/apache/lucene/pull/13542#discussion_r1731284306


##########
lucene/core/src/test/org/apache/lucene/search/TestIndexSearcher.java:
##########
@@ -293,4 +297,33 @@ public void testNullExecutorNonNullTaskExecutor() {
     IndexSearcher indexSearcher = new IndexSearcher(reader);
     assertNotNull(indexSearcher.getTaskExecutor());
   }
+
+  public void testSegmentPartitionsSameSlice() {
+    IndexSearcher indexSearcher =
+        new IndexSearcher(reader, Runnable::run) {
+          @Override
+          protected LeafSlice[] slices(List<LeafReaderContext> leaves) {
+            List<LeafSlice> slices = new ArrayList<>();
+            for (LeafReaderContext ctx : leaves) {
+              slices.add(
+                  new LeafSlice(
+                      new ArrayList<>(
+                          List.of(
+                              LeafReaderContextPartition.createFromAndTo(ctx, 
0, 1),
+                              LeafReaderContextPartition.createFrom(ctx, 
1)))));
+            }
+            return slices.toArray(new LeafSlice[0]);
+          }
+        };
+    try {
+      indexSearcher.getSlices();
+      fail("should throw exception");
+    } catch (IllegalStateException e) {
+      assertEquals(
+          "The same slice targets multiple partitions of the same leaf reader. 
"
+              + "A segment should rather get partitioned to be searched 
concurrently from as many slices as the "
+              + "number of partitions it is split into.",
+          e.getMessage());
+    }

Review Comment:
   yes, not sure why I didn't.



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