Lucene - Core
  1. Lucene - Core
  2. LUCENE-5129

CategoryAssociationsContainer should not allow null associations

    Details

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

      Description

      Currently you can set a null CategoryAssociation to a CategoryPath, but alas, it's just dropped by AssociationFacetFields. The history behind this break is that in the past, category associations were indexed twice, with and without the association value. In the move to 4.2 I guess with all the transitions the code went through, this behavior was nuked (as it doesn't make sense in general to index these categories twice), but AssociationFacetFields has a comment that these categories are added anyway – this is of course wrong.

      Instead of supporting null category associations, which is not so trivial in AssociationFacetFields, I think that we should just prevent it (throw a hard exception). If a user wants to add a category such as Category/Computer Science=0.74 (i.e. with weight 0.74) and be able to aggregate Category/ with and without associations, he should either write a special FacetsAggregator which ignores the associated value, or add the category twice, once using FacetFields (counting) and second time with AssociationFacetFields.

      I'll post a patch soon.

        Activity

        Hide
        Shai Erera added a comment -

        Patch prevents setting a null association. All tests pass. I'll wait some before I commit.

        Show
        Shai Erera added a comment - Patch prevents setting a null association. All tests pass. I'll wait some before I commit.
        Hide
        ASF subversion and git services added a comment -

        Commit 1506526 from Shai Erera in branch 'dev/trunk'
        [ https://svn.apache.org/r1506526 ]

        LUCENE-5129: CategoryAssociationsContainer should not allow null associations

        Show
        ASF subversion and git services added a comment - Commit 1506526 from Shai Erera in branch 'dev/trunk' [ https://svn.apache.org/r1506526 ] LUCENE-5129 : CategoryAssociationsContainer should not allow null associations
        Hide
        ASF subversion and git services added a comment -

        Commit 1506534 from Shai Erera in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1506534 ]

        LUCENE-5129: CategoryAssociationsContainer should not allow null associations

        Show
        ASF subversion and git services added a comment - Commit 1506534 from Shai Erera in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1506534 ] LUCENE-5129 : CategoryAssociationsContainer should not allow null associations
        Hide
        Shai Erera added a comment -

        Committed to trunk and 4x.

        Show
        Shai Erera added a comment - Committed to trunk and 4x.
        Hide
        Adrien Grand added a comment -

        4.5 release -> bulk close

        Show
        Adrien Grand added a comment - 4.5 release -> bulk close

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development