mirror of https://github.com/apache/lucene.git
LUCENE-8390: Replace MatchesIteratorSupplier with IOSupplier
This commit is contained in:
parent
1197176110
commit
963cceebff
|
@ -135,6 +135,9 @@ API Changes:
|
||||||
|
|
||||||
* LUCENE-8379: Add experimental TermQuery.getTermStates method (Mike McCandless)
|
* LUCENE-8379: Add experimental TermQuery.getTermStates method (Mike McCandless)
|
||||||
|
|
||||||
|
* LUCENE-8390: MatchesIteratorSupplier replaced by IOSupplier (Alan Woodward,
|
||||||
|
David Smiley)
|
||||||
|
|
||||||
Bug Fixes:
|
Bug Fixes:
|
||||||
|
|
||||||
* LUCENE-8380: UTF8TaxonomyWriterCache inconsistency. (Ruslan Torobaev, Dawid Weiss)
|
* LUCENE-8380: UTF8TaxonomyWriterCache inconsistency. (Ruslan Torobaev, Dawid Weiss)
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import org.apache.lucene.util.IOSupplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the positions and optionally offsets of all matching terms in a query
|
* Reports the positions and optionally offsets of all matching terms in a query
|
||||||
* for a single document
|
* 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
|
* 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
|
// The indirection here, using a Supplier object rather than a MatchesIterator
|
||||||
// directly, is to allow for multiple calls to Matches.getMatches() to return
|
// directly, is to allow for multiple calls to Matches.getMatches() to return
|
||||||
|
|
Loading…
Reference in New Issue