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/25 17:14:24 UTC

[GitHub] [lucene] javanna opened a new pull request #766: LUCENE-10002: Add FixedBitSetCollector and corresponding collector manager to test framework

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


   Some tests collect matching docs in a FixedBitSet. In the effort of moving such tests to using IndexSearcher#search(Query, CollectorManager) as part of LUCENE-10002, this commit adds a new FixedBitSetCollector class that exposes this functionality as well as a createManager method that returns a corresponding 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.
   - [x] I have run `./gradlew check`.
   - [ ] I have added tests for my changes. (not applicable, modifies existing tests)
   


-- 
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 #766: LUCENE-10002: Add FixedBitSetCollector and corresponding collector manager to test framework

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



##########
File path: lucene/test-framework/src/java/org/apache/lucene/tests/search/FixedBitSetCollector.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.tests.search;
+
+import java.io.IOException;
+import java.util.Collection;
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.search.CollectorManager;
+import org.apache.lucene.search.ScoreMode;
+import org.apache.lucene.search.SimpleCollector;
+import org.apache.lucene.util.FixedBitSet;
+
+/** Collector that accumulates matching docs in a {@link FixedBitSet} */
+public class FixedBitSetCollector extends SimpleCollector {
+  private final FixedBitSet bitSet;
+
+  private int docBase;
+
+  FixedBitSetCollector(int maxDoc) {
+    this.bitSet = new FixedBitSet(maxDoc);

Review comment:
       we are going to create one fixed bit set with size maxDoc for each leaf slice. This is ok for testing, yet I am wondering if a similar collector could be useful in production code, in which case we may want to improve it. I see [KnnVectoryQuery](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/KnnVectorQuery.java#L205) has something similar that I am planning to move to a collector manager and I wonder whether we should try and share code between these two scenarios (test changed in this PR and knn vector query)




-- 
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 #766: LUCENE-10002: Add FixedBitSetCollector and corresponding collector manager to test framework

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


   


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