@Override
public boolean incrementToken() throws IOException {
if(input.incrementToken()){
incrementCount++;
boolean first = true;
TokenData token;
boolean lookup = false;
int lastMatchable = -1;
int lastIndex = -1;
if(log.isTraceEnabled()){
log.trace("> solr:[{},{}] {}",new Object[]{
offset.startOffset(), offset.endOffset(), termAtt});
}
while((token = nextToken(first)) != null){
if(log.isTraceEnabled()) {
log.trace(" < [{},{}]:{} (link {}, match; {})",new Object[]{
token.token.getStart(), token.token.getEnd(),token.getTokenText(),
token.isLinkable, token.isMatchable});
}
first = false;
if(token.isLinkable){
lookup = true;
} else if (token.isMatchable){
lastMatchable = token.index;
lastIndex = lastMatchable;
} //else if(token.hasAlphaNumeric){
// lastIndex = token.index;
//}
}
//lookahead
if(!lookup && lastIndex >= 0 && sectionData != null){
List<TokenData> tokens = sectionData.getTokens();
int maxLookahead = Math.max(lastIndex, lastMatchable+3);
for(int i = lastIndex+1;!lookup && i < maxLookahead && i < tokens.size(); i++){
token = tokens.get(i);
if(token.isLinkable){
lookup = true;
} else if(token.isMatchable && (i+1) == maxLookahead){
maxLookahead++; //increase lookahead for matchable tokens
}
}
}
this.taggable.setTaggable(lookup);
if(lookup){
if(log.isTraceEnabled()){
TokenData t = getToken();
log.trace("lookup: token [{},{}]: {} | word [{},{}]:{}", new Object[]{
offset.startOffset(), offset.endOffset(), termAtt,
t.token.getStart(), t.token.getEnd(),
t.getTokenText()});
}
lookupCount++;
}
return true;
} else {