benwtrent commented on code in PR #13594: URL: https://github.com/apache/lucene/pull/13594#discussion_r1842215165
########## lucene/core/src/java/org/apache/lucene/search/AnnQueryUtils.java: ########## @@ -0,0 +1,81 @@ +/* + * 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.search; + +import java.io.IOException; +import org.apache.lucene.util.BitSet; +import org.apache.lucene.util.BitSetIterator; +import org.apache.lucene.util.Bits; + +/** Common utilities for ANN queries. */ +class AnnQueryUtils { Review Comment: this needs to be a `final` class ########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java: ########## @@ -53,8 +55,13 @@ abstract class AbstractKnnVectorQuery extends Query { private static final TopDocs NO_RESULTS = TopDocsCollector.EMPTY_TOPDOCS; + /** the KNN vector field to search */ protected final String field; + + /** the number of documents to find */ protected final int k; + + /** the filter to executed before KNN search */ Review Comment: While the filter is executed before search to gather the relevant bit set, we should be clear that when the filter is applied is up to the underlying knn index. ########## lucene/core/src/java/org/apache/lucene/search/AnnQueryUtils.java: ########## @@ -0,0 +1,81 @@ +/* + * 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.search; + +import java.io.IOException; +import org.apache.lucene.util.BitSet; +import org.apache.lucene.util.BitSetIterator; +import org.apache.lucene.util.Bits; + +/** Common utilities for ANN queries. */ +class AnnQueryUtils { Review Comment: And can we name it `KnnQueryUtils` since all the queries are `Knn` queries? ########## lucene/core/src/java/org/apache/lucene/search/KnnQueryUtils.java: ########## @@ -0,0 +1,81 @@ +/* + * 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.search; + +import java.io.IOException; +import org.apache.lucene.util.BitSet; +import org.apache.lucene.util.BitSetIterator; +import org.apache.lucene.util.Bits; + +/** Common utilities for KNN queries. */ +class KnnQueryUtils { Review Comment: ```suggestion final class KnnQueryUtils { ``` ########## lucene/core/src/java/org/apache/lucene/search/AbstractKnnVectorQuery.java: ########## @@ -116,6 +115,7 @@ private TopDocs searchLeaf( return results; } + // Execute the filter if any and perform KNN search at each segment. Review Comment: this comment doesn't make sense to me. If we really want to add java docs to private methods, lets fix the wording. Maybe something like "Perform kNN search for the provided LeafReaderContext applying filterWeight as necessary" -- 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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org