You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2025/02/25 12:39:45 UTC
(lucene) branch main updated: Remove IOException from DocIdSet#iterator signature (#14284)
This is an automated email from the ASF dual-hosted git repository.
javanna 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 b1beb0235df Remove IOException from DocIdSet#iterator signature (#14284)
b1beb0235df is described below
commit b1beb0235dfa70da5e790ea44e88ee2c30b5a8d2
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Tue Feb 25 13:39:38 2025 +0100
Remove IOException from DocIdSet#iterator signature (#14284)
There is no implementation of DocIdSet#iterator that throws IOException.
This commit removes throwing IOException from its signature.
---
lucene/CHANGES.txt | 2 ++
lucene/core/src/java/org/apache/lucene/search/DocIdSet.java | 4 ++--
.../src/java/org/apache/lucene/util/IntArrayDocIdSet.java | 2 +-
lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java | 2 +-
.../src/java/org/apache/lucene/util/RoaringDocIdSet.java | 12 ++++++------
.../src/test/org/apache/lucene/search/IntArrayDocIdSet.java | 3 +--
.../lucene/spatial/prefix/ContainsPrefixTreeQuery.java | 4 ++--
7 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index e8816607773..c03e75ee37a 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -14,6 +14,8 @@ API Changes
* GITHUB#14160: Adjusts the default HNSW search behavior so that filter optimized search is enabled
when 60% or less of vectors pass the pre-filter. (Ben Chaplin, Ben Trent)
+* GITHUB#14284: Remove IOException from DocIdSet#iterator signature (Luca Cavanna)
+
New Features
---------------------
* GITHUB#14097: Binary partitioning merge policy over float-valued vector field. (Mike Sokolov)
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java b/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
index 1655b6a8c8f..7e75aa8f5e8 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocIdSet.java
@@ -52,7 +52,7 @@ public abstract class DocIdSet implements Accountable {
public static DocIdSet all(int maxDoc) {
return new DocIdSet() {
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return DocIdSetIterator.all(maxDoc);
}
@@ -72,7 +72,7 @@ public abstract class DocIdSet implements Accountable {
* Provides a {@link DocIdSetIterator} to access the set. This implementation can return <code>
* null</code> if there are no docs that match.
*/
- public abstract DocIdSetIterator iterator() throws IOException;
+ public abstract DocIdSetIterator iterator();
// TODO: somehow this class should express the cost of
// iteration vs the cost of random access Bits; for
diff --git a/lucene/core/src/java/org/apache/lucene/util/IntArrayDocIdSet.java b/lucene/core/src/java/org/apache/lucene/util/IntArrayDocIdSet.java
index 4f764b37dfd..d1b1df867fe 100644
--- a/lucene/core/src/java/org/apache/lucene/util/IntArrayDocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/util/IntArrayDocIdSet.java
@@ -55,7 +55,7 @@ final class IntArrayDocIdSet extends DocIdSet {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new IntArrayDocIdSetIterator(docs, length);
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java b/lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java
index d1f6b9654eb..6ee7b692a29 100644
--- a/lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/util/NotDocIdSet.java
@@ -66,7 +66,7 @@ public final class NotDocIdSet extends DocIdSet {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
final DocIdSetIterator inIterator = in.iterator();
return new DocIdSetIterator() {
diff --git a/lucene/core/src/java/org/apache/lucene/util/RoaringDocIdSet.java b/lucene/core/src/java/org/apache/lucene/util/RoaringDocIdSet.java
index 77038dd07ed..b291aa2516d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/RoaringDocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/util/RoaringDocIdSet.java
@@ -167,7 +167,7 @@ public class RoaringDocIdSet extends DocIdSet {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
int i = -1; // this is the index of the current document in the array
@@ -178,7 +178,7 @@ public class RoaringDocIdSet extends DocIdSet {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
if (++i >= docIDs.length) {
return doc = NO_MORE_DOCS;
}
@@ -196,7 +196,7 @@ public class RoaringDocIdSet extends DocIdSet {
}
@Override
- public int advance(int target) throws IOException {
+ public int advance(int target) {
// binary search
int lo = i + 1;
int hi = docIDs.length - 1;
@@ -219,7 +219,7 @@ public class RoaringDocIdSet extends DocIdSet {
}
@Override
- public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) throws IOException {
+ public void intoBitSet(int upTo, FixedBitSet bitSet, int offset) {
if (doc >= upTo) {
return;
}
@@ -257,7 +257,7 @@ public class RoaringDocIdSet extends DocIdSet {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
if (cardinality == 0) {
return null;
}
@@ -270,7 +270,7 @@ public class RoaringDocIdSet extends DocIdSet {
DocIdSetIterator sub;
int doc;
- Iterator() throws IOException {
+ Iterator() {
doc = -1;
block = -1;
sub = DocIdSetIterator.empty();
diff --git a/lucene/core/src/test/org/apache/lucene/search/IntArrayDocIdSet.java b/lucene/core/src/test/org/apache/lucene/search/IntArrayDocIdSet.java
index fa4ddece1e4..b7d6715fbba 100644
--- a/lucene/core/src/test/org/apache/lucene/search/IntArrayDocIdSet.java
+++ b/lucene/core/src/test/org/apache/lucene/search/IntArrayDocIdSet.java
@@ -16,7 +16,6 @@
*/
package org.apache.lucene.search;
-import java.io.IOException;
import java.util.Arrays;
import org.apache.lucene.util.ArrayUtil;
@@ -45,7 +44,7 @@ class IntArrayDocIdSet extends DocIdSet {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
return new DocIdSetIterator() {
int i = 0;
int doc = -1;
diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeQuery.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeQuery.java
index 2e2551d10b0..0beaf2e97ba 100644
--- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeQuery.java
+++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/ContainsPrefixTreeQuery.java
@@ -299,7 +299,7 @@ public class ContainsPrefixTreeQuery extends AbstractPrefixTreeQuery {
}
@Override
- public DocIdSetIterator iterator() throws IOException {
+ public DocIdSetIterator iterator() {
if (size() == 0) return null;
// copy the unsorted values to a new array then sort them
int d = 0;
@@ -329,7 +329,7 @@ public class ContainsPrefixTreeQuery extends AbstractPrefixTreeQuery {
}
@Override
- public int nextDoc() throws IOException {
+ public int nextDoc() {
if (++idx < size) return docs[idx];
return NO_MORE_DOCS;
}