[
https://issues.apache.org/jira/browse/LUCENE-2529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12917650#action_12917650
]
Robert Muir commented on LUCENE-2529:
-------------------------------------
bq. but there is some other increment logic in this class that foils my
attempts to coordinate the positions across multiple fields, particularly when
the first value is non-existent for a multi-valued field.
I don't think this will ever completely work correctly though, for example the
only way to "accumulate" positions across a field that ends with a stopword /
all stopwords would be to add a positional equivalent to end() that we did for
offsets, so that highlighting would work for multi-valued fields. otherwise
reset() -> clearAttributes() and the PositionIncrementAttribute is "lost"
I think if you are trying to coordinate positions across multi-valued fields,
it probably means you shouldn't be using a multivalued field. It seems to only
make sense to put multiple *independent* values in a multi-valued field, not
ones that are "continuations" of each other. By definition if they are
continuations of each other, I think its better to index the whole thing as
single-valued... and you have complete control of the positions within your
tokenstream.
> always apply position increment gap between values
> --------------------------------------------------
>
> Key: LUCENE-2529
> URL: https://issues.apache.org/jira/browse/LUCENE-2529
> 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 DocInverterPerField.java line 82:
> if (fieldState.length > 0)
> fieldState.position +=
> docState.analyzer.getPositionIncrementGap(fieldInfo.name);
> This is checking fieldState.length. I think the condition should simply be:
> if (i > 0).
> 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: [email protected]
For additional commands, e-mail: [email protected]