org.apache.lucene.facet.params
Enum CategoryListParams.OrdinalPolicy

java.lang.Object
  extended by java.lang.Enum<CategoryListParams.OrdinalPolicy>
      extended by org.apache.lucene.facet.params.CategoryListParams.OrdinalPolicy
All Implemented Interfaces:
Serializable, Comparable<CategoryListParams.OrdinalPolicy>
Enclosing class:
CategoryListParams

public static enum CategoryListParams.OrdinalPolicy
extends Enum<CategoryListParams.OrdinalPolicy>

Defines which category ordinals are encoded for every document. This also affects how category ordinals are aggregated, check the different policies for more details.


Enum Constant Summary
ALL_BUT_DIMENSION
          Encodes the ordinals of all path components except the dimension.
ALL_PARENTS
          Encodes the ordinals of all path components.
NO_PARENTS
          Encodes only the ordinals of leaf nodes.
 
Method Summary
static CategoryListParams.OrdinalPolicy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CategoryListParams.OrdinalPolicy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NO_PARENTS

public static final CategoryListParams.OrdinalPolicy NO_PARENTS
Encodes only the ordinals of leaf nodes. That is, for the category A/B/C, the ordinals of A and A/B will not be encoded. This policy is efficient for hierarchical dimensions, as it reduces the number of ordinals that are visited per document. During faceted search, this policy behaves exactly like ALL_PARENTS, and the counts of all path components will be computed as well.

NOTE: this CategoryListParams.OrdinalPolicy requires a special collector or accumulator, which will fix the parents' counts.

NOTE: since only leaf nodes are encoded for the document, you should use this policy when the same document doesn't share two categories that have a mutual parent, or otherwise the counts will be wrong (the mutual parent will be over-counted). For example, if a document has the categories A/B/C and A/B/D, then with this policy the counts of "A" and "B" will be 2, which is wrong. If you intend to index hierarchical dimensions, with more than one category per document, you should use either ALL_PARENTS or ALL_BUT_DIMENSION.


ALL_PARENTS

public static final CategoryListParams.OrdinalPolicy ALL_PARENTS
Encodes the ordinals of all path components. That is, the category A/B/C will encode the ordinals of A and A/B as well. If you don't require the dimension's count during search, consider using ALL_BUT_DIMENSION.


ALL_BUT_DIMENSION

public static final CategoryListParams.OrdinalPolicy ALL_BUT_DIMENSION
Encodes the ordinals of all path components except the dimension. The dimension of a category is defined to be the first components in CategoryPath.components. For the category A/B/C, the ordinal of A/B will be encoded as well, however not the ordinal of A.

NOTE: when facets are aggregated, this policy behaves exactly like ALL_PARENTS, except that the dimension is never counted. I.e. if you ask to count the facet "A", then while in ALL_PARENTS you will get counts for "A" and its children, with this policy you will get counts for only its children. This policy is the default one, and makes sense for using with flat dimensions, whenever your application does not require the dimension's count. Otherwise, use ALL_PARENTS.

Method Detail

values

public static CategoryListParams.OrdinalPolicy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CategoryListParams.OrdinalPolicy c : CategoryListParams.OrdinalPolicy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CategoryListParams.OrdinalPolicy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


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