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

All Superinterfaces:
Serializable
All Known Implementing Classes:
NonTopLevelOrdinalPolicy

public interface OrdinalPolicy
extends Serializable

A policy for adding category parent ordinals to the list of ordinals that are encoded for a given document. The default ALL_PARENTS policy always adds all parents, where NO_PARENTS never adds any parents.

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

Field Summary
static OrdinalPolicy ALL_PARENTS
          An OrdinalPolicy which stores all parent ordinals, except TaxonomyReader.ROOT_ORDINAL.
static OrdinalPolicy NO_PARENTS
          An OrdinalPolicy which never stores parent ordinals.
 
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.
 

Field Detail

NO_PARENTS

static final OrdinalPolicy NO_PARENTS
An OrdinalPolicy which never stores parent ordinals. Useful if you only want to store the exact categories that were added to the document. Note that this is a rather expert policy, which requires a matching FacetsAccumulator that computes the weight of the parent categories on-the-fly.


ALL_PARENTS

static final OrdinalPolicy ALL_PARENTS
An OrdinalPolicy which stores all parent ordinals, except TaxonomyReader.ROOT_ORDINAL. This is the default OrdinalPolicy and works with the default FacetsAccumulator.

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.


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