mocobeta commented on a change in pull request #1169: LUCENE-9004: A minor
feature and patch -- support deleting vector values and fix segments merging
URL: https://github.com/apache/lucene-solr/pull/1169#discussion_r368289244
##########
File path: lucene/core/src/test/org/apache/lucene/index/TestKnnGraph.java
##########
@@ -92,7 +108,277 @@ public void testSingleDocRecall() throws Exception {
iw.commit();
assertConsistentGraph(iw, values);
- assertRecall(dir, 0, values[0]);
+ assertRecall(dir, 1, values[0]);
+ }
+ }
+
+ public void testDocsDeletionAndRecall() throws Exception {
+ /**
+ * {@code KnnExactVectorValueWeight} applies in-set (i.e. the query vector
is exactly in the index)
+ * deletion strategy to filter all unmatched results searched by {@link
org.apache.lucene.search.KnnGraphQuery.KnnExactVectorValueQuery},
+ * and deletes at most ef*segmentCnt vectors that are the same to the
specified queryVector.
+ */
+ final class KnnExactVectorValueWeight extends ConstantScoreWeight {
Review comment:
Thanks, it looks almost okay to me but the Weight and Query classes can be
(and should be) *static* classes.
It would look like this:
```
public class TestKnnGraph extends LuceneTestCase {
....
private static final class KnnExactVectorValueWeight extends
ConstantScoreWeight {
....
}
private static final class KnnExactVectorValueQuery extends Query {
....
}
public void testDocsDeletionAndRecall() throws Exception {
....
Query query = new KnnExactVectorValueQuery(...);
....
}
....
}
```
Please avoid *non-static* inner classes whenever you can do so, because they
consume extra memory and object references ;)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]