Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected IntervalsSource analyzeText(CachingTokenFilter stream, int maxGaps, bo
// formulate a single term, boolean, or phrase.

if (numTokens == 0) {
return null;
return NO_INTERVALS;
} else if (numTokens == 1) {
// single term
return analyzeTerm(stream);
Expand Down Expand Up @@ -231,7 +231,7 @@ protected List<IntervalsSource> analyzeGraph(TokenStream source) throws IOExcept
return clauses;
}

private static final IntervalsSource NO_INTERVALS = new IntervalsSource() {
static final IntervalsSource NO_INTERVALS = new IntervalsSource() {

@Override
public IntervalIterator intervals(String field, LeafReaderContext ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public void testPhraseWithStopword() throws IOException {

}

public void testEmptyTokenStream() throws IOException {
CannedTokenStream ts = new CannedTokenStream();
IntervalsSource source = BUILDER.analyzeText(new CachingTokenFilter(ts), 0, true);
assertSame(IntervalBuilder.NO_INTERVALS, source);
}

public void testSimpleSynonyms() throws IOException {

CannedTokenStream ts = new CannedTokenStream(
Expand Down