Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2529

always apply position increment gap between values

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9.3, 3.0.2, 3.1, 4.0-ALPHA
    • 3.1, 4.0-ALPHA
    • core/index
    • None
    • (I don't know which version to say this affects since it's some quasi trunk release and the new versioning scheme confuses me.)

    • New, Patch Available

    Description

      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.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            koji Koji Sekiguchi
            dsmiley David Smiley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment