org.apache.lucene.facet.index.categorypolicy
Interface OrdinalPolicy

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultOrdinalPolicy, NonTopLevelOrdinalPolicy

public interface OrdinalPolicy
extends Serializable

Filtering category ordinals in CategoryParentsStream, where a given category ordinal is added to the stream, and than its parents are being added one after the other using TaxonomyWriter.getParent(int).
That loop should have a stop point - the default approach (excluding the ROOT) is implemented in DefaultOrdinalPolicy.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Method Summary
 void init(TaxonomyWriter taxonomyWriter)
          Initialize the policy with a TaxonomyWriter.
 boolean shouldAdd(int ordinal)
          Check whether a given category ordinal should be added to the stream.
 

Method Detail

shouldAdd

boolean shouldAdd(int ordinal)
Check whether a given category ordinal should be added to the stream.

Parameters:
ordinal - A given category ordinal which is to be tested for stream addition.
Returns:
true if the category should be added. false otherwise.

init

void init(TaxonomyWriter taxonomyWriter)
Initialize the policy with a TaxonomyWriter. This method can be implemented as noop if the ordinal policy is not taxonomy dependent

Parameters:
taxonomyWriter - A relevant taxonomyWriter object, with which ordinals sent to shouldAdd(int) are examined.