shubhamsrkdev commented on code in PR #16197:
URL: https://github.com/apache/lucene/pull/16197#discussion_r3358171020
##########
lucene/monitor/src/java/org/apache/lucene/monitor/ReadonlyQueryIndex.java:
##########
@@ -79,7 +81,21 @@ public long search(QueryBuilder queryBuilder, QueryCollector
matcher) throws IOE
queryBuilder.buildQuery(
termFilters.get(searcher.getIndexReader().getReaderCacheHelper().getKey()));
buildTime = System.nanoTime() - buildTime;
- searcher.search(query, collector);
+ searcher.search(
+ query,
+ new CollectorManager<LazyMonitorQueryCollector, Void>() {
+ @Override
+ public LazyMonitorQueryCollector newCollector() {
+ return collector;
+ }
+
+ @Override
+ public Void reduce(Collection<LazyMonitorQueryCollector>
collectors) {
+ assert collectors.size() == 1
+ : "QueryCollector needs to be made thread-safe before an
executor can be provided to the index searcher used by monitor";
+ return null;
+ }
Review Comment:
This is same across files, worth putting in a common place?
##########
lucene/monitor/src/java/org/apache/lucene/monitor/ReadonlyQueryIndex.java:
##########
@@ -79,7 +81,21 @@ public long search(QueryBuilder queryBuilder, QueryCollector
matcher) throws IOE
queryBuilder.buildQuery(
termFilters.get(searcher.getIndexReader().getReaderCacheHelper().getKey()));
buildTime = System.nanoTime() - buildTime;
- searcher.search(query, collector);
+ searcher.search(
+ query,
+ new CollectorManager<LazyMonitorQueryCollector, Void>() {
Review Comment:
I see that it's common across the two files, worth putting in one place?
--
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]