Lucene - Core
  1. Lucene - Core
  2. LUCENE-2996

addIndexes(IndexReader) incorrectly applies existing deletes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2, 4.0-ALPHA
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      If you perform these operations:

      1. deleteDocuments(Term) for all the new documents
      2. addIndexes(IndexReader)
      3. commit

      Then addIndexes applies the previous deletes on the incoming indexes as well, which is incorrect. If you call addIndexes(Directory) instead, the deletes are applied beforehand, as they should. The solution, as Mike indicated here: http://osdir.com/ml/general/2011-03/msg20876.html is to add flush(false,true) to addIndexes(IndexReader).

      I will create a patch with a matching unit test shortly.

      1. LUCENE-2996.patch
        3 kB
        Shai Erera
      2. LUCENE-2996.patch
        3 kB
        Shai Erera

        Activity

        Hide
        Shai Erera added a comment -

        Patch adds a test to TestAddIndexes and the trivial fix to IndexWriter (against 3x).

        I will port to trunk and 3.1 branch after a review.

        Show
        Shai Erera added a comment - Patch adds a test to TestAddIndexes and the trivial fix to IndexWriter (against 3x). I will port to trunk and 3.1 branch after a review.
        Hide
        Simon Willnauer added a comment -

        Shai, patch looks ok.

        shouldn't the test use newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()) instead of new IndexWriterConfig(...)

        Show
        Simon Willnauer added a comment - Shai, patch looks ok. shouldn't the test use newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()) instead of new IndexWriterConfig(...)
        Hide
        Shai Erera added a comment -

        shouldn't the test use newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()) instead of new IndexWriterConfig(...)

        Good catch ! it was a remnant from the time this test was a static main().

        Show
        Shai Erera added a comment - shouldn't the test use newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer()) instead of new IndexWriterConfig(...) Good catch ! it was a remnant from the time this test was a static main().
        Hide
        Shai Erera added a comment -

        Committed revision 1086275 (3x).
        Committed revision 1086288 (trunk).

        I don't know if it's ok to commit to branches/lucene_solr_3_1 just yet, so I'll keep this open for now.

        Show
        Shai Erera added a comment - Committed revision 1086275 (3x). Committed revision 1086288 (trunk). I don't know if it's ok to commit to branches/lucene_solr_3_1 just yet, so I'll keep this open for now.
        Hide
        Shai Erera added a comment -

        Committed revision 1087647 (3.1.1).

        Show
        Shai Erera added a comment - Committed revision 1087647 (3.1.1).
        Hide
        Robert Muir added a comment -

        Bulk closing for 3.2

        Show
        Robert Muir added a comment - Bulk closing for 3.2

          People

          • Assignee:
            Shai Erera
            Reporter:
            Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development