sohami commented on code in PR #12606:
URL: https://github.com/apache/lucene/pull/12606#discussion_r1357659905
##########
lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java:
##########
@@ -420,13 +418,12 @@ public int count(Query query) throws IOException {
}
/**
- * Returns the leaf slices used for concurrent searching, or null if no
{@code Executor} was
- * passed to the constructor.
+ * Returns the leaf slices used for concurrent searching
*
* @lucene.experimental
*/
public LeafSlice[] getSlices() {
- return (executor == null) ? null : leafSlicesSupplier.get();
+ return leafSlicesSupplier.get();
Review Comment:
@javanna `getSlices()` was kept as a convenience method to handle the null
executor case such that usage in `IndexSearcher` doesn't have to explicitly
perform check for both `executor` being `null` and return value of
`leafSlices`.
This method will be useful if consumer wants to know the slices created by
the provider or the count of slices. For example: In OpenSearch, we are using
this method to emit a metric around slice count per searcher which can give
indication around if a search request is getting too many slices and if we need
to adjust that by providing some other slice provider.
Also `slices()` method was kept protected such that extensions can provide
their own implementation of it to control how `slices` are generated.
--
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]