You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2021/09/03 12:47:21 UTC
[lucene] branch main updated: LUCENE-9620: Implement
AssertingWeight#count.
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new b3ce44c LUCENE-9620: Implement AssertingWeight#count.
b3ce44c is described below
commit b3ce44cd0d76e1f437490c17a6cf37a7657a0fe9
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Fri Sep 3 14:43:32 2021 +0200
LUCENE-9620: Implement AssertingWeight#count.
---
.../src/java/org/apache/lucene/search/AssertingWeight.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java b/lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java
index e61224c..857e2dc 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java
@@ -34,6 +34,15 @@ class AssertingWeight extends FilterWeight {
}
@Override
+ public int count(LeafReaderContext context) throws IOException {
+ final int count = in.count(context);
+ if (count < -1 || count > context.reader().numDocs()) {
+ throw new AssertionError("count=" + count + ", numDocs=" + context.reader().numDocs());
+ }
+ return count;
+ }
+
+ @Override
public Matches matches(LeafReaderContext context, int doc) throws IOException {
Matches matches = in.matches(context, doc);
if (matches == null) return null;