mirror of https://github.com/apache/lucene.git
LUCENE-1320
ShingleMatrixFilter, a multidimensional shingle token filter. Bug fix, did not support empty input token streams. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@674367 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc65b35533
commit
ddc7c290d0
|
@ -719,7 +719,7 @@ public class ShingleMatrixFilter extends TokenStream {
|
|||
|
||||
public boolean hasNext() {
|
||||
int s = columnRowCounters.length;
|
||||
return columnRowCounters[s - 1] < columns.get(s - 1).getRows().size();
|
||||
return s != 0 && columnRowCounters[s - 1] < columns.get(s - 1).getRows().size();
|
||||
}
|
||||
|
||||
public Column.Row[] next() {
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.lucene.analysis.Token;
|
|||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.miscellaneous.PrefixAndSuffixAwareTokenFilter;
|
||||
import org.apache.lucene.analysis.miscellaneous.SingleTokenTokenStream;
|
||||
import org.apache.lucene.analysis.miscellaneous.EmptyTokenStream;
|
||||
import org.apache.lucene.analysis.payloads.PayloadHelper;
|
||||
import org.apache.lucene.analysis.shingle.ShingleMatrixFilter.Matrix;
|
||||
import org.apache.lucene.analysis.shingle.ShingleMatrixFilter.Matrix.Column;
|
||||
|
@ -42,7 +43,14 @@ public class TestShingleMatrixFilter extends TestCase {
|
|||
Token token = new Token(); // for debug use only
|
||||
|
||||
|
||||
|
||||
|
||||
TokenStream ts;
|
||||
|
||||
|
||||
ts = new ShingleMatrixFilter(new EmptyTokenStream(), 1, 2, ' ', false, new ShingleMatrixFilter.OneDimensionalNonWeightedTokenSettingsCodec());
|
||||
assertNull(ts.next());
|
||||
|
||||
TokenListStream tls;
|
||||
LinkedList<Token> tokens;
|
||||
|
||||
|
|
Loading…
Reference in New Issue