return a.length - b.length;
}
});
for (int i = 0; i < tokens.length; i++) {
AttributeSource token = tokens[i];
final NamedList<Object> tokenNamedList = new SimpleOrderedMap<Object>();
final String rawText = token.addAttribute(CharTermAttribute.class).toString();
String text = fieldType.indexedToReadable(rawText);
tokenNamedList.add("text", text);
if (!text.equals(rawText)) {
tokenNamedList.add("raw_text", rawText);
}
if (context.getTermsToMatch().contains(rawText)) {
tokenNamedList.add("match", true);
}
token.reflectWith(new AttributeReflector() {
public void reflect(Class<? extends Attribute> attClass, String key, Object value) {
// leave out position and term
if (CharTermAttribute.class.isAssignableFrom(attClass))
return;
if (PositionIncrementAttribute.class.isAssignableFrom(attClass))