Class IndexableElementTypeHelper

java.lang.Object
org.ametys.cms.data.type.indexing.IndexableElementTypeHelper
All Implemented Interfaces:
Component, Serviceable

public class IndexableElementTypeHelper extends Object implements Component, Serviceable
Helper for indexable element types
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      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 field
      valueToIndex - the value to index
      context - the context of the data to index. Can not be null
      logger - 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

      public static String getStringTextFieldSuffix(DataContext context)
      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

      public static boolean isStringDataFacetable(DataContext context)
      Checks if data of type string is facetable
      Parameters:
      context - the data context
      Returns:
      true if the type string is facetable, false otherwise
    • isEnumerated

      public static boolean isEnumerated(DataContext context)
      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 field
      valueToIndex - the value to index
      context - the context of the data to index. Can not be null
      logger - 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.