Class ElementParserServiceImpl<T>

java.lang.Object
org.craftercms.search.commons.service.impl.ElementParserServiceImpl<T>
Type Parameters:
T - the type of document for the search engine
All Implemented Interfaces:
ElementParserService<T>

public class ElementParserServiceImpl<T> extends Object implements ElementParserService<T>
Default implementation of the ElementParserService. Parses the element using a list of ElementParsers. If first parser returns false (the element was not handled), it calls the second one and so on. It also handles elements tagged with the "indexable" attribute. If the attribute is present, and it's false, the element is not parsed.
Author:
avasquez
  • Field Details

    • DEFAULT_FIELD_NAME_SEPARATOR

      public static final String DEFAULT_FIELD_NAME_SEPARATOR
      See Also:
    • DEFAULT_INDEXABLE_ATTRIBUTE_NAME

      public static final String DEFAULT_INDEXABLE_ATTRIBUTE_NAME
      See Also:
    • parsers

      protected List<ElementParser<T>> parsers
    • fieldNameSeparator

      protected String fieldNameSeparator
    • indexableAttributeName

      protected String indexableAttributeName
  • Constructor Details

    • ElementParserServiceImpl

      public ElementParserServiceImpl(List<ElementParser<T>> parsers)
  • Method Details

    • setFieldNameSeparator

      public void setFieldNameSeparator(String fieldNameSeparator)
    • getIndexableAttributeName

      public String getIndexableAttributeName()
    • parse

      public void parse(org.dom4j.Element element, String parentFieldName, T doc)
      Description copied from interface: ElementParserService
      Parses the given element, generating one or more fields and adding them to the given document.
      Specified by:
      parse in interface ElementParserService<T>
      Parameters:
      element - the element to parse
      parentFieldName - the field name of the parent
      doc - the document to add the generated fields