public class CountingListBuilder extends Object implements CategoryListBuilder
CategoryListBuilder
which builds a counting list data by encoding
the category ordinals into one or more BytesRef
. Each
BytesRef
corresponds to a set of ordinals that belong to the same
partition. When partitions are not enabled (i.e.
FacetIndexingParams.getPartitionSize()
returns
Integer.MAX_VALUE
), only one BytesRef
is returned by this
class.
Counting lists are used usually for computing the weight of categories by summing their number of occurrences (hence counting) in a result set.
Constructor and Description |
---|
CountingListBuilder(CategoryListParams categoryListParams,
FacetIndexingParams indexingParams,
TaxonomyWriter taxoWriter) |
Modifier and Type | Method and Description |
---|---|
Map<String,BytesRef> |
build(IntsRef ordinals,
Iterable<CategoryPath> categories)
Every returned
BytesRef corresponds to a single partition (as
defined by FacetIndexingParams.getPartitionSize() ) and the key
denotes the partition ID. |
public CountingListBuilder(CategoryListParams categoryListParams, FacetIndexingParams indexingParams, TaxonomyWriter taxoWriter)
public Map<String,BytesRef> build(IntsRef ordinals, Iterable<CategoryPath> categories) throws IOException
BytesRef
corresponds to a single partition (as
defined by FacetIndexingParams.getPartitionSize()
) and the key
denotes the partition ID. When no partitions are defined, the returned map
contains only one value.
NOTE: the ordinals
array is modified by adding parent
ordinals to it. Also, some encoders may sort the array and remove duplicate
ordinals. Therefore you may want to invoke this method after you finished
processing the array for other purposes.
build
in interface CategoryListBuilder
IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.