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

PostingsEnum should have consistent flags behavior

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.1
    • None
    • None
    • New

    Description

      When asking for flags like OFFSETS or PAYLOADS with DocsAndPositionsEnum, the behavior was to always return an enum, even if offsets or payloads were not indexed. They would just not be available from the enum if they were not present. This behavior was carried over to PostingsEnum, which is good.

      However, the new POSITIONS flag has different behavior. If positions are not available, null is returned, instead of a PostingsEnum that just gives access to freqs. This behavior is confusing, as it means you have to special case asking for positions (only ask if you know they were indexed) which sort of defeats the purpose of the unified PostingsEnum.

      We should make POSITIONS have the same behavior as other flags. The trickiest part will be maintaining backcompat for DocsAndPositionsEnum in 5.x, but I think it can be done.

      Attachments

        1. LUCENE-6271.patch
          79 kB
          Robert Muir
        2. LUCENE-6271.patch
          73 kB
          Ryan Ernst

        Activity

          People

            rcmuir Robert Muir
            rjernst Ryan Ernst
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: