lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yonik Seeley <ysee...@gmail.com>
Subject Re: Spans, appended fields, and term positions
Date Mon, 21 Nov 2005 21:09:04 GMT
> > For position increments, it doesn't have to be tracked. The patch to
> > DocumentWriter could also be:
> >
> >       int position = fieldPositions[fieldNumber];
> > +      if (position>0) position+=analyzer.getPositionIncrementGap
> > (fieldName)
>
> This could be thwarted with tokens using zero position offsets
> though, no?

I haven't seen it, but if someone were to set all position increments
to zero for a field, then yes it wouldn't work.  Checking length
(which counts tokens) would work though:

+ if (length>0) position+=analyzer.getPositionIncrementGap (fieldName)

It is either expand Field slightly, or expand Analyzer.

Sort of... one is adding a new data member, one is behavioral.

> The Analyzer extensions seem fine, but much more general purpose than my need.

For your need (a global increment), isn't expanding analyzer actually easier?
analyser = new OldAnalyzer() {
  public int getPositionIncrementGap(String field) {
    return 1000;
  }
}

-Yonik

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message