Class NonTopLevelOrdinalPolicy

  extended by org.apache.lucene.facet.index.categorypolicy.NonTopLevelOrdinalPolicy
All Implemented Interfaces:
Serializable, OrdinalPolicy

public class NonTopLevelOrdinalPolicy
extends Object
implements OrdinalPolicy

Filter out any "top level" category ordinals.

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

Constructor Summary
          Constructs a new non-top-level-ordinal-filter.
Method Summary
 void init(TaxonomyWriter taxonomyWriter)
          Initialize the policy with a TaxonomyWriter.
 boolean shouldAdd(int ordinal)
          Filters out ordinal which are ROOT or who's parent is ROOT.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public NonTopLevelOrdinalPolicy()
Constructs a new non-top-level-ordinal-filter. With a given taxonomyWriter.

Method Detail


public void init(TaxonomyWriter taxonomyWriter)
Description copied from interface: OrdinalPolicy
Initialize the policy with a TaxonomyWriter. This method can be implemented as noop if the ordinal policy is not taxonomy dependent

Specified by:
init in interface OrdinalPolicy
taxonomyWriter - A relevant taxonomyWriter object, with which ordinals sent to shouldAdd(int) are examined.


public boolean shouldAdd(int ordinal)
Filters out ordinal which are ROOT or who's parent is ROOT. In order to determine if a parent is root, there's a need for TaxonomyWriter.getParent(int).

Specified by:
shouldAdd in interface OrdinalPolicy
ordinal - A given category ordinal which is to be tested for stream addition.
true if the category should be added. false otherwise.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.