Index: lucene/CHANGES.txt =================================================================== --- lucene/CHANGES.txt (revision 1506484) +++ lucene/CHANGES.txt (working copy) @@ -84,6 +84,10 @@ searchAfter exceeds the number of documents in the reader. (Crocket via Shai Erera) +* LUCENE-5129: CategoryAssociationsContaier no longer supports null association + values for categories. If you want to index categories without an + association, you should add them using FacetFields. (Shai Erera) + Optimizations * LUCENE-5088: Added TermFilter to filter docs by a specific term. Index: lucene/facet/src/java/org/apache/lucene/facet/associations/AssociationsListBuilder.java =================================================================== --- lucene/facet/src/java/org/apache/lucene/facet/associations/AssociationsListBuilder.java (revision 1506484) +++ lucene/facet/src/java/org/apache/lucene/facet/associations/AssociationsListBuilder.java (working copy) @@ -54,13 +54,6 @@ // build per-association key BytesRef CategoryAssociation association = associations.getAssociation(cp); - if (association == null) { - // it is ok to set a null association for a category - it's treated as a - // regular category in that case. - ++idx; - continue; - } - BytesRef bytes = res.get(association.getCategoryListID()); if (bytes == null) { bytes = new BytesRef(32); Index: lucene/facet/src/java/org/apache/lucene/facet/associations/CategoryAssociationsContainer.java =================================================================== --- lucene/facet/src/java/org/apache/lucene/facet/associations/CategoryAssociationsContainer.java (revision 1506484) +++ lucene/facet/src/java/org/apache/lucene/facet/associations/CategoryAssociationsContainer.java (working copy) @@ -30,11 +30,12 @@ /** * Adds the {@link CategoryAssociation} for the given {@link CategoryPath - * category}. Overrides any assocation that was previously set. It is ok to - * pass {@code null}, in which case the category will be treated as a regular - * one (i.e. without association value). + * category}. Overrides any assocation that was previously set. */ public void setAssociation(CategoryPath category, CategoryAssociation association) { + if (association == null) { + throw new IllegalArgumentException("cannot set a null association to a category"); + } categoryAssociations.put(category, association); }