mirror of https://github.com/apache/lucene.git
LUCENE-5129: CategoryAssociationsContainer should not allow null associations
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1506526 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7dfaf2e5fb
commit
f9bb96db81
|
@ -84,6 +84,10 @@ API Changes
|
|||
searchAfter exceeds the number of documents in the reader.
|
||||
(Crocket via Shai Erera)
|
||||
|
||||
* LUCENE-5129: CategoryAssociationsContainer no longer supports null
|
||||
association values for categories. If you want to index categories without
|
||||
associations, you should add them using FacetFields. (Shai Erera)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-5088: Added TermFilter to filter docs by a specific term.
|
||||
|
|
|
@ -54,13 +54,6 @@ public class AssociationsListBuilder implements CategoryListBuilder {
|
|||
// 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);
|
||||
|
|
|
@ -30,11 +30,12 @@ public class CategoryAssociationsContainer implements Iterable<CategoryPath> {
|
|||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue