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

Only read/write postings when there is at least one indexed field

Details

    • Task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.1
    • None
    • None
    • New

    Description

      Unlike points, norms, term vectors or doc values which only get written to the directory when at least one of the fields uses the data structure, postings always get written to the directory.

      While this isn't hurting much, it can be surprising at times, e.g. if you index with SimpleText you will have a file for postings even though none of the fields indexes postings. This inconsistency is hidden with the default codec due to the fact that it uses PerFieldPostingsFormat, which only delegates to any of the per-field codecs if any of the fields is actually indexed, so you don't actually get a file if none of the fields is indexed.

      We noticed this behavior by creating a codec that throws UnsupportedOperationException for postings since it's not expected to have postings, and it always fails writing or reading data. While it's easy to work around this issue on top of Lucene by using a dummy postings format, it would be better to fix Lucene to handle postings consistently with other data structures?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jpountz Adrien Grand
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 10m
                  2h 10m