Skip to content

Apache Lucene open-source search software

LUCENE-8390: Replace MatchesIteratorSupplier with IOSupplier

Alan Woodward963cceebffae
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index a526ae4a80a..fe36f3ad82d 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -135,6 +135,9 @@ API Changes:
* LUCENE-8379: Add experimental TermQuery.getTermStates method (Mike McCandless)
+* LUCENE-8390: MatchesIteratorSupplier replaced by IOSupplier (Alan Woodward,
+ David Smiley)
+
Bug Fixes:
* LUCENE-8380: UTF8TaxonomyWriterCache inconsistency. (Ruslan Torobaev, Dawid Weiss)
diff --git a/lucene/core/src/java/org/apache/lucene/search/Matches.java b/lucene/core/src/java/org/apache/lucene/search/Matches.java
index de9a692ee6d..c832e74a2ff 100644
--- a/lucene/core/src/java/org/apache/lucene/search/Matches.java
+++ b/lucene/core/src/java/org/apache/lucene/search/Matches.java
@@ -26,6 +26,8 @@ import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
+import org.apache.lucene.util.IOSupplier;
+
/**
* Reports the positions and optionally offsets of all matching terms in a query
* for a single document
@@ -96,19 +98,10 @@ public interface Matches extends Iterable<String> {
};
}
- /**
- * A functional interface that supplies a {@link MatchesIterator}
- */
- @FunctionalInterface
- interface MatchesIteratorSupplier {
- /** Return a new {@link MatchesIterator} */
- MatchesIterator get() throws IOException;
- }
-
/**
* Create a Matches for a single field
*/
- static Matches forField(String field, MatchesIteratorSupplier mis) throws IOException {
+ static Matches forField(String field, IOSupplier<MatchesIterator> mis) throws IOException {
// The indirection here, using a Supplier object rather than a MatchesIterator
// directly, is to allow for multiple calls to Matches.getMatches() to return