apupier commented on code in PR #21909:
URL: https://github.com/apache/camel/pull/21909#discussion_r2911304680


##########
components/camel-lucene/src/main/java/org/apache/camel/component/lucene/LuceneSearcher.java:
##########
@@ -89,7 +90,8 @@ private int doSearch(String searchPhrase, int 
maxNumberOfHits, int totalHitsThre
 
         QueryParser parser = new QueryParser("contents", analyzer);
         Query query = parser.parse(searchPhrase);
-        TopScoreDocCollector collector = 
TopScoreDocCollector.create(maxNumberOfHits, totalHitsThreshold);
+        TopScoreDocCollector collector
+                = new TopScoreDocCollectorManager(maxNumberOfHits, 
totalHitsThreshold).newCollector();
         indexSearcher.search(query, collector);

Review Comment:
   to avoid using the deprecated search method, I think we should use something 
like:
   
   ```
           TopScoreDocCollectorManager topScoreDocCollectorManager
                   = new TopScoreDocCollectorManager(maxNumberOfHits, 
totalHitsThreshold);
           indexSearcher.search(query, topScoreDocCollectorManager);
           TopScoreDocCollector collector = 
topScoreDocCollectorManager.newCollector();
           hits = collector.topDocs().scoreDocs;
   ```



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

Reply via email to