public class FacetsConfig extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
FacetsConfig.DimConfig
Holds the configuration for one dimension
|
static class |
FacetsConfig.DrillDownTermsIndexing
Drill down terms indexing option to control whether dimension and sub-path terms should be
indexed.
|
Modifier and Type | Field and Description |
---|---|
static FacetsConfig.DimConfig |
DEFAULT_DIM_CONFIG
Default per-dimension configuration.
|
static String |
DEFAULT_INDEX_FIELD_NAME
Which Lucene field holds the drill-downs and ords (as
doc values).
|
static char |
DELIM_CHAR
Character used to join the category path components together into a single
drill down term for indexing.
|
Constructor and Description |
---|
FacetsConfig()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Document |
build(Document doc)
Translates any added
FacetField s into normal fields for indexing;
only use this version if you did not add any taxonomy-based fields (
FacetField or AssociationFacetField ). |
Document |
build(TaxonomyWriter taxoWriter,
Document doc)
Translates any added
FacetField s into normal fields for indexing. |
protected BytesRef |
dedupAndEncode(IntsRef ordinals)
Encodes ordinals into a BytesRef; expert: subclass can
override this to change encoding.
|
protected FacetsConfig.DimConfig |
getDefaultDimConfig()
Get the default configuration for new dimensions.
|
FacetsConfig.DimConfig |
getDimConfig(String dimName)
Get the current configuration for a dimension.
|
Map<String,FacetsConfig.DimConfig> |
getDimConfigs()
Returns map of field name to
FacetsConfig.DimConfig . |
static String |
pathToString(String[] path)
Turns a dim + path into an encoded string.
|
static String |
pathToString(String[] path,
int length)
Turns the first
length elements of path into an encoded string. |
static String |
pathToString(String dim,
String[] path)
Turns a dim + path into an encoded string.
|
void |
setDrillDownTermsIndexing(String dimName,
FacetsConfig.DrillDownTermsIndexing drillDownTermsIndexing)
Specify drill down terms option on the field / dimension.
|
void |
setHierarchical(String dimName,
boolean v)
Pass
true if this dimension is hierarchical
(has depth > 1 paths). |
void |
setIndexFieldName(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.
|
void |
setMultiValued(String dimName,
boolean value)
Pass
true if this dimension may have more than one value per document. |
void |
setRequireDimCount(String dimName,
boolean value)
Pass
true if at search time you require accurate counts of the dimension, i.e. |
void |
setRequireDimensionDrillDown(String dimName,
boolean value)
Deprecated.
|
static String[] |
stringToPath(String s)
Turns an encoded string (from a previous call to
pathToString(java.lang.String, java.lang.String[]) ) back into the original String[] . |
public static final String DEFAULT_INDEX_FIELD_NAME
public static final FacetsConfig.DimConfig DEFAULT_DIM_CONFIG
public static final char DELIM_CHAR
pathToString(java.lang.String, java.lang.String[])
).protected FacetsConfig.DimConfig getDefaultDimConfig()
multivalue =
true
.FacetsConfig
public FacetsConfig.DimConfig getDimConfig(String dimName)
public void setHierarchical(String dimName, boolean v)
true
if this dimension is hierarchical
(has depth > 1 paths).public void setMultiValued(String dimName, boolean value)
true
if this dimension may have more than one value per document.public void setRequireDimCount(String dimName, boolean value)
true
if at search time you require accurate counts of the dimension, i.e. how many
hits have this dimension.public void setIndexFieldName(String dimName, String indexFieldName)
@Deprecated public void setRequireDimensionDrillDown(String dimName, boolean value)
setDrillDownTermsIndexing(String, DrillDownTermsIndexing)
insteadpublic void setDrillDownTermsIndexing(String dimName, FacetsConfig.DrillDownTermsIndexing drillDownTermsIndexing)
public Map<String,FacetsConfig.DimConfig> getDimConfigs()
FacetsConfig.DimConfig
.public Document build(Document doc) throws IOException
FacetField
s into normal fields for indexing;
only use this version if you did not add any taxonomy-based fields (
FacetField
or AssociationFacetField
).
NOTE: you should add the returned document to IndexWriter, not the input one!
IOException
public Document build(TaxonomyWriter taxoWriter, Document doc) throws IOException
FacetField
s into normal fields for indexing.
NOTE: you should add the returned document to IndexWriter, not the input one!
IOException
protected BytesRef dedupAndEncode(IntsRef ordinals)
public static String pathToString(String dim, String[] path)
public static String pathToString(String[] path)
public static String pathToString(String[] path, int length)
length
elements of path
into an encoded string.public static String[] stringToPath(String s)
pathToString(java.lang.String, java.lang.String[])
) back into the original String[]
.Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.