LUCENE-8390: Replace MatchesIteratorSupplier with IOSupplier

This commit is contained in:
Alan Woodward 2018-07-09 10:07:10 +01:00
parent 1197176110
commit 963cceebff
2 changed files with 6 additions and 10 deletions

View File

@ -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)

View File

@ -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