On 21 Nov 2005, at 12:55, Yonik Seeley wrote:
On 11/21/05, Erik Hatcher <[EMAIL PROTECTED]> wrote:
Modifying Analyzer as you have suggested would
require DocumentWriter additionally keep track of the field names
and note when one is used again.

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?

Talk of position increments feels like it belongs more in Analyzer.
Do you actually need to control that per field instance (rather than
per field name/type?)

For my purpose it is actually a global need - all successive instances of fields will have this offset specified, but setting this on a per-Field instance is no problem.

I think your patch straight-forward and probably the simplest for the
user, and the most flexible (if it's needed to that degree). I just
don't know if anyone has objections to expanding the Field class even
more (and with analysis stuff), so I'm throwing out possible
alternatives.

It is either expand Field slightly, or expand Analyzer. The Analyzer extensions seem fine, but much more general purpose than my need. So being practical, if there is no current use case then we should stick with the concrete.

As for Doug's comments, I'll add javadocs for sure, and increase the warnings on getBoost() while I'm at it. In fact, getPositionOffset() isn't technically needed (nor getBoost() for that matter), but I'll add it just to be complete, but add thorough warnings.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to