use of org.apache.solr.legacy.LegacyNumericTokenStream in project lucene-solr by apache.
the class TestNumericTokenStream method testCTA.
public void testCTA() throws Exception {
final LegacyNumericTokenStream stream = new LegacyNumericTokenStream();
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
stream.addAttribute(CharTermAttribute.class);
});
assertTrue(e.getMessage().startsWith("LegacyNumericTokenStream does not support"));
e = expectThrows(IllegalArgumentException.class, () -> {
stream.addAttribute(TestAttribute.class);
});
assertTrue(e.getMessage().startsWith("LegacyNumericTokenStream does not support"));
stream.close();
}
use of org.apache.solr.legacy.LegacyNumericTokenStream in project lucene-solr by apache.
the class TestNumericTokenStream method testCaptureStateAfterExhausted.
/** LUCENE-7027 */
public void testCaptureStateAfterExhausted() throws Exception {
// default precstep
try (LegacyNumericTokenStream stream = new LegacyNumericTokenStream()) {
// int
stream.setIntValue(ivalue);
stream.reset();
while (stream.incrementToken()) ;
stream.captureState();
stream.end();
stream.captureState();
// long
stream.setLongValue(lvalue);
stream.reset();
while (stream.incrementToken()) ;
stream.captureState();
stream.end();
stream.captureState();
}
// huge precstep
try (LegacyNumericTokenStream stream = new LegacyNumericTokenStream(Integer.MAX_VALUE)) {
// int
stream.setIntValue(ivalue);
stream.reset();
while (stream.incrementToken()) ;
stream.captureState();
stream.end();
stream.captureState();
// long
stream.setLongValue(lvalue);
stream.reset();
while (stream.incrementToken()) ;
stream.captureState();
stream.end();
stream.captureState();
}
}
Aggregations