You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/03/24 22:58:35 UTC

[GitHub] [lucene] javanna opened a new pull request #763: LUCENE-10002: Replace some more usages of search(Query, Collector)

javanna opened a new pull request #763:
URL: https://github.com/apache/lucene/pull/763


   This commit replaces some more usages of IndexSearcher#search(Query, Collector) with IndexSearcher#search(Query, CollectorManager)
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/lucene/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Lucene maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz commented on a change in pull request #763: LUCENE-10002: Replace usages of search(Query, Collector) in CheckHits

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #763:
URL: https://github.com/apache/lucene/pull/763#discussion_r838709808



##########
File path: lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java
##########
@@ -634,12 +694,13 @@ public static void checkTopScores(Random random, Query query, IndexSearcher sear
 
   private static void doCheckTopScores(Query query, IndexSearcher searcher, int numHits)
       throws IOException {
-    TopScoreDocCollector collector1 =
-        TopScoreDocCollector.create(numHits, null, Integer.MAX_VALUE); // COMPLETE
-    TopScoreDocCollector collector2 = TopScoreDocCollector.create(numHits, null, 1); // TOP_SCORES
-    searcher.search(query, collector1);
-    searcher.search(query, collector2);
-    checkEqual(query, collector1.topDocs().scoreDocs, collector2.topDocs().scoreDocs);
+    CollectorManager<TopScoreDocCollector, TopDocs> complete =
+        TopScoreDocCollector.createSharedManager(numHits, null, Integer.MAX_VALUE);
+    ScoreDoc[] completeScoreDocs = searcher.search(query, complete).scoreDocs;
+    CollectorManager<TopScoreDocCollector, TopDocs> topScores =
+        TopScoreDocCollector.createSharedManager(numHits, null, 1);

Review comment:
       Ah, it didn't look obvious to me because the case is different but I agree it's good enough, sorry for the noise.




-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz merged pull request #763: LUCENE-10002: Replace usages of search(Query, Collector) in CheckHits

Posted by GitBox <gi...@apache.org>.
jpountz merged pull request #763:
URL: https://github.com/apache/lucene/pull/763


   


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a change in pull request #763: LUCENE-10002: Replace usages of search(Query, Collector) in CheckHits

Posted by GitBox <gi...@apache.org>.
javanna commented on a change in pull request #763:
URL: https://github.com/apache/lucene/pull/763#discussion_r838664696



##########
File path: lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java
##########
@@ -634,12 +694,13 @@ public static void checkTopScores(Random random, Query query, IndexSearcher sear
 
   private static void doCheckTopScores(Query query, IndexSearcher searcher, int numHits)
       throws IOException {
-    TopScoreDocCollector collector1 =
-        TopScoreDocCollector.create(numHits, null, Integer.MAX_VALUE); // COMPLETE
-    TopScoreDocCollector collector2 = TopScoreDocCollector.create(numHits, null, 1); // TOP_SCORES
-    searcher.search(query, collector1);
-    searcher.search(query, collector2);
-    checkEqual(query, collector1.topDocs().scoreDocs, collector2.topDocs().scoreDocs);
+    CollectorManager<TopScoreDocCollector, TopDocs> complete =
+        TopScoreDocCollector.createSharedManager(numHits, null, Integer.MAX_VALUE);
+    ScoreDoc[] completeScoreDocs = searcher.search(query, complete).scoreDocs;
+    CollectorManager<TopScoreDocCollector, TopDocs> topScores =
+        TopScoreDocCollector.createSharedManager(numHits, null, 1);

Review comment:
       I have renamed the variables to indicate that, doesn't that replace the comments?




-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] jpountz commented on a change in pull request #763: LUCENE-10002: Replace usages of search(Query, Collector) in CheckHits

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #763:
URL: https://github.com/apache/lucene/pull/763#discussion_r838607150



##########
File path: lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java
##########
@@ -634,12 +694,13 @@ public static void checkTopScores(Random random, Query query, IndexSearcher sear
 
   private static void doCheckTopScores(Query query, IndexSearcher searcher, int numHits)
       throws IOException {
-    TopScoreDocCollector collector1 =
-        TopScoreDocCollector.create(numHits, null, Integer.MAX_VALUE); // COMPLETE
-    TopScoreDocCollector collector2 = TopScoreDocCollector.create(numHits, null, 1); // TOP_SCORES
-    searcher.search(query, collector1);
-    searcher.search(query, collector2);
-    checkEqual(query, collector1.topDocs().scoreDocs, collector2.topDocs().scoreDocs);
+    CollectorManager<TopScoreDocCollector, TopDocs> complete =
+        TopScoreDocCollector.createSharedManager(numHits, null, Integer.MAX_VALUE);
+    ScoreDoc[] completeScoreDocs = searcher.search(query, complete).scoreDocs;
+    CollectorManager<TopScoreDocCollector, TopDocs> topScores =
+        TopScoreDocCollector.createSharedManager(numHits, null, 1);

Review comment:
       Can you keep the "COMPLETE" / "TOP_SCORES" comments that indicate the ScoreMode that gets used for these various collectors?




-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org