Class IndexableElementTypeHelper
java.lang.Object
org.ametys.cms.data.type.indexing.IndexableElementTypeHelper
- All Implemented Interfaces:
Component
,Serviceable
Helper for indexable element types
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getStringIndexingFieldSuffix
(DataContext context) Retrieves the indexing solr field suffix for type stringstatic String
getStringTextFieldSuffix
(DataContext context) Retrieves the text solr field suffix for type stringstatic String
getStringWildcardFieldSuffix
(DataContext context) Retrieves the wildcard solr field suffix for type stringstatic void
indexFileValue
(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootObjectDocument, String fieldName, File valueToIndex, DataContext context, Logger logger) Index the given binary value in a solr document.static void
indexFulltextValue
(org.apache.solr.common.SolrInputDocument document, String text, DataContext context) Index a full-text value.static void
indexFulltextValue
(org.apache.solr.common.SolrInputDocument currentDocument, org.apache.solr.common.SolrInputDocument ametysObjectDocument, String text, DataContext context) Index a full-text value.static void
indexStringValue
(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootObjectDocument, String fieldName, String valueToIndex, DataContext context, Logger logger) Index the given string value in a solr document.static boolean
isEnumerated
(DataContext context) Checks if the data is enumerated (=> if its definition has an enumerator)static boolean
isStringDataFacetable
(DataContext context) Checks if data of type string is facetablevoid
service
(ServiceManager manager)
-
Field Details
-
FULL_PREFIX
Unstemmed full-text field prefix- See Also:
-
FULL_STEMMED_PREFIX
Stemmed full-text field prefix.- See Also:
-
FULL_GENERAL
Full-text field name with general text indexation.- See Also:
-
FULL_EXACT_WS
Full-text with simple white-space tokenization.- See Also:
-
-
Constructor Details
-
IndexableElementTypeHelper
public IndexableElementTypeHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
indexStringValue
public static void indexStringValue(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootObjectDocument, String fieldName, String valueToIndex, DataContext context, Logger logger) Index the given string value in a solr document.- Parameters:
document
- the solr document to index into.rootObjectDocument
- the solr document of the root object.fieldName
- the name of the indexing fieldvalueToIndex
- the value to indexcontext
- the context of the data to index. Can not be nulllogger
- the logger to log in WARN level in case of the given string is too long and will be truncated
-
getStringIndexingFieldSuffix
Retrieves the indexing solr field suffix for type string- Parameters:
context
- the indexable data context- Returns:
- the indexing solr field suffix for type string
-
getStringWildcardFieldSuffix
Retrieves the wildcard solr field suffix for type string- Parameters:
context
- the indexable data context- Returns:
- the wildcard solr field suffix for type string
-
getStringTextFieldSuffix
Retrieves the text solr field suffix for type string- Parameters:
context
- the indexable data context- Returns:
- the text solr field suffix for type string
-
isStringDataFacetable
Checks if data of type string is facetable- Parameters:
context
- the data context- Returns:
true
if the type string is facetable,false
otherwise
-
isEnumerated
Checks if the data is enumerated (=> if its definition has an enumerator)- Parameters:
context
- the data context- Returns:
true
if the data is enumerated,false
otherwise
-
indexFileValue
public static void indexFileValue(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootObjectDocument, String fieldName, File valueToIndex, DataContext context, Logger logger) Index the given binary value in a solr document.- Parameters:
document
- the solr document to index into.rootObjectDocument
- the solr document of the root object.fieldName
- the name of the indexing fieldvalueToIndex
- the value to indexcontext
- the context of the data to index. Can not be nulllogger
- the logger to log in WARN level in case of an error occurs while indexing the given binary
-
indexFulltextValue
public static void indexFulltextValue(org.apache.solr.common.SolrInputDocument currentDocument, org.apache.solr.common.SolrInputDocument ametysObjectDocument, String text, DataContext context) Index a full-text value.- Parameters:
currentDocument
- The current document, can be either the ametys object document itself or a repeater document.ametysObjectDocument
- The parent ametys object document.text
- The text to index.context
- The context of the data to index.
-
indexFulltextValue
public static void indexFulltextValue(org.apache.solr.common.SolrInputDocument document, String text, DataContext context) Index a full-text value.- Parameters:
document
- The document to index into.text
- The text to index.context
- The context of the data to index.
-