use of org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute in project zm-mailbox by Zimbra.
the class ZimbraAnalyzerTest method positionIncrement.
/**
* We intentionally disable the positionIncrement because we want phrases to match across removed stop words.
*
* @see PositionIncrementAttribute
*/
@Test
public void positionIncrement() throws Exception {
TokenStream stream = ZimbraAnalyzer.getInstance().tokenStream(LuceneFields.L_H_SUBJECT, new StringReader("It's a test."));
PositionIncrementAttribute posIncrAtt = stream.addAttribute(PositionIncrementAttribute.class);
while (stream.incrementToken()) {
Assert.assertEquals(posIncrAtt.getPositionIncrement(), 1);
}
stream.end();
stream.close();
}
Aggregations