lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Smiley (JIRA)" <>
Subject [jira] Commented: (LUCENE-2529) always apply position increment gap between values
Date Mon, 04 Oct 2010 17:10:32 GMT


David Smiley commented on LUCENE-2529:

Rob, I don't completely follow your first paragraph, but this patch I posted _does_ work correctly
for what I'm doing.  It is one part of the puzzle in searching multi-valued fields at coordinated
positions.  The other part is span queries with field masking.  For my problem space, I'm
willing to sacrifice the ability to do phrase queries.  I can't do them because my solution
forces all position increments to 0, but using a gap.

My patch here (and the patch already applied by Koji recently) for this issue isn't really
code specific to the problem I'm solving, but it is necessary for my approach, and I think
makes the logic in this class easier to follow and more consistent with respect to the behavior
of the position increment gap and handling of the very first position increment.  All existing
tests pass.  On the basis of that alone, I'm hopeful that you, Michael, and other committers
are amenable to applying this patch.

I acknowledge I could try to operate completely within a single value and thereby have more
control over the position increments.  That's an idea I didn't think of, thanks.  But I believe
the point I just made on my patch being an improvement stands.

> always apply position increment gap between values
> --------------------------------------------------
>                 Key: LUCENE-2529
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.9.3, 3.0.2, 3.1, 4.0
>         Environment: (I don't know which version to say this affects since it's some
quasi trunk release and the new versioning scheme confuses me.)
>            Reporter: David Smiley
>            Assignee: Koji Sekiguchi
>            Priority: Minor
>             Fix For: 3.1, 4.0
>         Attachments: LUCENE-2529_always_apply_position_increment_gap_between_values.patch,
LUCENE-2529_skip_posIncr_for_1st_token.patch, LUCENE-2529_skip_posIncr_for_1st_token.patch
>   Original Estimate: 1h
>  Remaining Estimate: 1h
> I'm doing some fancy stuff with span queries that is very sensitive to term positions.
 I discovered that the position increment gap on indexing is only applied between values when
there are existing terms indexed for the document.  I suspect this logic wasn't deliberate,
it's just how its always been for no particular reason.  I think it should always apply the
gap between fields.  Reference line 82:
> if (fieldState.length > 0)
>           fieldState.position += docState.analyzer.getPositionIncrementGap(;
> This is checking fieldState.length.  I think the condition should simply be:  if (i >
> I don't think this change will affect anyone at all but it will certainly help me.  Presently,
I can either change this line in Lucene, or I can put in a hack so that the first value for
the document is some dummy value which is wasteful.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message