Lucene - Core
  1. Lucene - Core
  2. LUCENE-4633

DirectoryTaxonomyWriter.replaceTaxonomy should refresh the reader

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.1, 6.0
    • Component/s: modules/facet
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      While migrating code to Lucene 4.0 I tripped it. If you call replaceTaxonomy() with e.g. a taxonomy index that contains category "a", and then you try to add category "a" to the new taxonomy, it receives a new ordinal!

      The reason is that replaceTaxo doesn't refresh the internal IndexReader, but does clear the cache (as it should). This causes the next addCategory to not find category "a" in the cache, and not in the reader instance at hand.

      Simple fix, I'll attach a patch with it and a test exposing the bug.

        Activity

        Hide
        Shai Erera added a comment -

        Patch with fix and test (added to TestDirTaxoWriter.testReplaceTaxo).

        I plan to commit this shortly.

        Show
        Shai Erera added a comment - Patch with fix and test (added to TestDirTaxoWriter.testReplaceTaxo). I plan to commit this shortly.
        Hide
        Gilad Barkai added a comment -

        +1 patch looks good.

        Show
        Gilad Barkai added a comment - +1 patch looks good.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Shai Erera
        http://svn.apache.org/viewvc?view=revision&revision=1422495

        LUCENE-4633: DirectoryTaxonomyWriter.replaceTaxonomy should refresh its reader

        Show
        Commit Tag Bot added a comment - [trunk commit] Shai Erera http://svn.apache.org/viewvc?view=revision&revision=1422495 LUCENE-4633 : DirectoryTaxonomyWriter.replaceTaxonomy should refresh its reader
        Hide
        Shai Erera added a comment -

        Committed to 4x and trunk

        Show
        Shai Erera added a comment - Committed to 4x and trunk
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Shai Erera
        http://svn.apache.org/viewvc?view=revision&revision=1422497

        LUCENE-4633: DirectoryTaxonomyWriter.replaceTaxonomy should refresh its reader

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Shai Erera http://svn.apache.org/viewvc?view=revision&revision=1422497 LUCENE-4633 : DirectoryTaxonomyWriter.replaceTaxonomy should refresh its reader

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development