public class FacetsConfig
extends java.lang.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
|
Modifier and Type | Field and Description |
---|---|
static FacetsConfig.DimConfig |
DEFAULT_DIM_CONFIG
Default per-dimension configuration.
|
static java.lang.String |
DEFAULT_INDEX_FIELD_NAME
Which Lucene field holds the drill-downs and ords (as
doc values).
|
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(java.lang.String dimName)
Get the current configuration for a dimension.
|
java.util.Map<java.lang.String,FacetsConfig.DimConfig> |
getDimConfigs()
Returns map of field name to
FacetsConfig.DimConfig . |
static java.lang.String |
pathToString(java.lang.String[] path)
Turns a dim + path into an encoded string.
|
static java.lang.String |
pathToString(java.lang.String[] path,
int length)
Turns the first
length elements of path into an encoded string. |
static java.lang.String |
pathToString(java.lang.String dim,
java.lang.String[] path)
Turns a dim + path into an encoded string.
|
void |
setHierarchical(java.lang.String dimName,
boolean v)
Pass
true if this dimension is hierarchical
(has depth > 1 paths). |
void |
setIndexFieldName(java.lang.String dimName,
java.lang.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(java.lang.String dimName,
boolean v)
Pass
true if this dimension may have more than
one value per document. |
void |
setRequireDimCount(java.lang.String dimName,
boolean v)
Pass
true if at search time you require
accurate counts of the dimension, i.e. |
void |
setRequireDimensionDrillDown(java.lang.String dimName,
boolean v)
Specify whether drill down on just the dimension is necessary.
|
static java.lang.String[] |
stringToPath(java.lang.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 java.lang.String DEFAULT_INDEX_FIELD_NAME
public static final FacetsConfig.DimConfig DEFAULT_DIM_CONFIG
protected FacetsConfig.DimConfig getDefaultDimConfig()
multivalue =
true
.FacetsConfig
public FacetsConfig.DimConfig getDimConfig(java.lang.String dimName)
public void setHierarchical(java.lang.String dimName, boolean v)
true
if this dimension is hierarchical
(has depth > 1 paths).public void setMultiValued(java.lang.String dimName, boolean v)
true
if this dimension may have more than
one value per document.public void setRequireDimCount(java.lang.String dimName, boolean v)
true
if at search time you require
accurate counts of the dimension, i.e. how many
hits have this dimension.public void setIndexFieldName(java.lang.String dimName, java.lang.String indexFieldName)
public void setRequireDimensionDrillDown(java.lang.String dimName, boolean v)
public java.util.Map<java.lang.String,FacetsConfig.DimConfig> getDimConfigs()
FacetsConfig.DimConfig
.public Document build(Document doc) throws java.io.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!
java.io.IOException
public Document build(TaxonomyWriter taxoWriter, Document doc) throws java.io.IOException
FacetField
s into normal fields for indexing.
NOTE: you should add the returned document to IndexWriter, not the input one!
java.io.IOException
protected BytesRef dedupAndEncode(IntsRef ordinals)
public static java.lang.String pathToString(java.lang.String dim, java.lang.String[] path)
public static java.lang.String pathToString(java.lang.String[] path)
public static java.lang.String pathToString(java.lang.String[] path, int length)
length
elements of path
into an encoded string.public static java.lang.String[] stringToPath(java.lang.String s)
pathToString(java.lang.String, java.lang.String[])
) back into the original String[]
.Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.