Package org.apache.lucene.facet
Class FacetsConfig
java.lang.Object
org.apache.lucene.facet.FacetsConfig
Records per-dimension configuration. By default a
dimension is flat, single valued and does
not require count for the dimension; use
the setters in this class to change these settings for
each dim.
NOTE: this configuration is not saved into the
index, but it's vital, and up to the application to
ensure, that at search time the provided
FacetsConfig matches what was used during indexing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHolds the configuration for one dimension -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FacetsConfig.DimConfigDefault per-dimension configuration.static final StringWhich Lucene field holds the drill-downs and ords (as doc values). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionTranslates any addedFacetFields into normal fields for indexing; only use this version if you did not add any taxonomy-based fields (FacetFieldorAssociationFacetField).build(TaxonomyWriter taxoWriter, Document doc) Translates any addedFacetFields into normal fields for indexing.getDimConfig(String dimName) Get the current configuration for a dimension.Returns map of field name toFacetsConfig.DimConfig.static StringpathToString(String[] path) Turns a dim + path into an encoded string.static StringpathToString(String[] path, int length) Turns the firstlengthelements ofpathinto an encoded string.static StringpathToString(String dim, String[] path) Turns a dim + path into an encoded string.voidsetHierarchical(String dimName, boolean v) Passtrueif this dimension is hierarchical (has depth > 1 paths).voidsetIndexFieldName(String dimName, String indexFieldName) Specify which index field name should hold the ordinals for this dimension; this is only used by the taxonomy based facet methods.voidsetMultiValued(String dimName, boolean v) Passtrueif this dimension may have more than one value per document.voidsetRequireDimCount(String dimName, boolean v) Passtrueif at search time you require accurate counts of the dimension, i.e.static String[]Turns an encoded string (from a previous call topathToString(java.lang.String, java.lang.String[])) back into the originalString[].
-
Field Details
-
DEFAULT_INDEX_FIELD_NAME
Which Lucene field holds the drill-downs and ords (as doc values).- See Also:
-
DEFAULT_DIM_CONFIG
Default per-dimension configuration.
-
-
Constructor Details
-
FacetsConfig
public FacetsConfig()Default constructor.
-
-
Method Details
-
getDimConfig
Get the current configuration for a dimension. -
setHierarchical
Passtrueif this dimension is hierarchical (has depth > 1 paths). -
setMultiValued
Passtrueif this dimension may have more than one value per document. -
setRequireDimCount
Passtrueif at search time you require accurate counts of the dimension, i.e. how many hits have this dimension. -
setIndexFieldName
Specify which index field name should hold the ordinals for this dimension; this is only used by the taxonomy based facet methods. -
getDimConfigs
Returns map of field name toFacetsConfig.DimConfig. -
build
Translates any addedFacetFields into normal fields for indexing; only use this version if you did not add any taxonomy-based fields (FacetFieldorAssociationFacetField).NOTE: you should add the returned document to IndexWriter, not the input one!
- Throws:
IOException
-
build
Translates any addedFacetFields into normal fields for indexing.NOTE: you should add the returned document to IndexWriter, not the input one!
- Throws:
IOException
-
pathToString
Turns a dim + path into an encoded string. -
pathToString
Turns a dim + path into an encoded string. -
pathToString
Turns the firstlengthelements ofpathinto an encoded string. -
stringToPath
Turns an encoded string (from a previous call topathToString(java.lang.String, java.lang.String[])) back into the originalString[].
-