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

0 position increment not properly supported for the first token

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • New

    Description

      Setting a position increment of 0 for the first token in a field results in its "absolute position" (as well as increment) being read back later as Integer.MIN_VALUE.

      This is a result of how the information gets written out in DocumentsWriter: position should not be updated using += t.getPositionIncrement() - 1; and then always ++'ed in addPosition. It would be much simpler just to update it using t.getPositionIncrement().

      While this is fairly easy to fix in DocumentsWriter, one could just update the documentation for Token.setPositionIncrement() to indicate that for indexing purposes the first Token in a field must have a positive position increment.

      Attachments

        Activity

          People

            Unassigned Unassigned
            motinis Moti Nisenson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: