NonTopLevelOrdinalPolicy (Lucene 3.6.2 API)
Keywords: org.apache.lucene.facet.index.categorypolicy.NonTopLevelOrdinalPolicy class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.facet.index.categorypolicy
Class NonTopLevelOrdinalPolicy

    java.lang.Object
      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.
`shouldAdd(int)`.

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

Constructor Summary
`NonTopLevelOrdinalPolicy()` 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

### NonTopLevelOrdinalPolicy

    public NonTopLevelOrdinalPolicy()

  Constructs a new non-top-level-ordinal-filter. With a given taxonomyWriter.

Method Detail

### init

    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`
  Parameters:
    `taxonomyWriter` - A relevant taxonomyWriter object, with which ordinals sent to `shouldAdd(int)` are examined.

### shouldAdd

    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`
  Parameters:
    `ordinal` - A given category ordinal which is to be tested for stream addition.
  Returns:
    `true` if the category should be added. `false` otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD