Bruno--
You received this message because you are subscribed to the Google Groups "echoprint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to echoprint+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
public class HashFilter extends TokenFilter {protected final static Logger log = LoggerFactory.getLogger(HashFilter.class);private TermAttribute termAtt;private OffsetAttribute offAtt;private int prevOff;public HashFilter(TokenStream input) {super(input);termAtt = (TermAttribute) addAttribute(TermAttribute.class);offAtt = (OffsetAttribute) addAttribute(OffsetAttribute.class);}@Overridepublic boolean incrementToken() throws IOException {if(input.incrementToken()) {//// Save the state for this token, since we want the position in// the next token.State s = captureState();if(input.incrementToken()) {//// Parse the position from the next token. Wasteful, but what you// gonna do, unless we want to implement our own parseint.String ps = termAtt.term();int posn;try {posn = Integer.parseInt(ps);} catch(NumberFormatException ex) {throw new IOException(String.format("Bad offset %s", ps), ex);}restoreState(s);//// A finger print extends from the previous position to this one.offAtt.setOffset(prevOff, posn);prevOff = posn;return true;}}return false;}}
IllegalArgumentException: startOffset must be non-negative, and endOffset must be >= startOffset
Please correct me if I am wrong but from the discussion on this thread, it feels like whatever 'HashFilter' is doing is redundant and we can live with using a WhitespaceTokenizer and skipping time offsets while indexing hash codes. If this is the case then I think I can skip that 'setOffset' call and be done with this error.
Thanks & Regards,
Ravikant