T - the type of document for the search enginepublic abstract class AbstractDocumentBuilder<T> extends Object implements DocumentBuilder<T>
DocumentBuilder to add commons fields.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
copyFields |
static String |
DEFAULT_ID_FIELD_NAME |
static String |
DEFAULT_LOCAL_ID_FIELD_NAME |
static String |
DEFAULT_PUBLISHING_DATE_ALT_FIELD_NAME |
static String |
DEFAULT_PUBLISHING_DATE_FIELD_NAME |
static String |
DEFAULT_ROOT_ID_FIELD_NAME |
static String |
DEFAULT_SITE_FIELD_NAME |
protected FieldValueConverter |
fieldValueConverter |
protected String |
idFieldName |
protected String |
localIdFieldName |
protected ElementParserService<T> |
parserService |
protected List<DocumentPostProcessor<T>> |
postProcessors |
protected String |
publishingDateAltFieldName |
protected String |
publishingDateFieldName |
protected String |
rootIdFieldName |
protected String |
siteFieldName |
| Constructor and Description |
|---|
AbstractDocumentBuilder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addCopyFields(org.dom4j.Element element) |
protected abstract void |
addField(T doc,
String fieldName,
Object fieldValue) |
T |
build(String site,
String id,
Map<String,List<String>> fields)
Builds a document from the provided multi value map of fields
|
T |
build(String site,
String id,
String xml,
boolean ignoreRootInFieldNames)
Builds a document from the input XML.
|
protected abstract T |
createDoc() |
protected org.dom4j.io.SAXReader |
createSAXReader() |
protected String |
formatAsIso(Temporal temporal) |
protected void |
postProcess(T doc) |
void |
setCopyFields(Map<String,String> copyFields) |
void |
setFieldValueConverter(FieldValueConverter fieldValueConverter) |
void |
setIdFieldName(String idFieldName) |
void |
setLocalIdFieldName(String localIdFieldName) |
void |
setParserService(ElementParserService<T> parserService) |
void |
setPostProcessors(List<DocumentPostProcessor<T>> postProcessors) |
void |
setPublishingDateAltFieldName(String publishingDateAltFieldName) |
void |
setPublishingDateFieldName(String publishingDateFieldName) |
void |
setRootIdFieldName(String rootIdFieldName) |
void |
setSiteFieldName(String siteFieldName) |
public static final String DEFAULT_ID_FIELD_NAME
public static final String DEFAULT_ROOT_ID_FIELD_NAME
public static final String DEFAULT_SITE_FIELD_NAME
public static final String DEFAULT_LOCAL_ID_FIELD_NAME
public static final String DEFAULT_PUBLISHING_DATE_FIELD_NAME
public static final String DEFAULT_PUBLISHING_DATE_ALT_FIELD_NAME
protected String idFieldName
protected String rootIdFieldName
protected String siteFieldName
protected String localIdFieldName
protected String publishingDateFieldName
protected String publishingDateAltFieldName
protected ElementParserService<T> parserService
protected FieldValueConverter fieldValueConverter
protected List<DocumentPostProcessor<T>> postProcessors
public void setIdFieldName(String idFieldName)
public void setRootIdFieldName(String rootIdFieldName)
public void setSiteFieldName(String siteFieldName)
public void setLocalIdFieldName(String localIdFieldName)
public void setPublishingDateFieldName(String publishingDateFieldName)
public void setPublishingDateAltFieldName(String publishingDateAltFieldName)
public void setParserService(ElementParserService<T> parserService)
public void setFieldValueConverter(FieldValueConverter fieldValueConverter)
public void setPostProcessors(List<DocumentPostProcessor<T>> postProcessors)
protected abstract T createDoc()
public T build(String site, String id, String xml, boolean ignoreRootInFieldNames) throws DocumentBuildException
DocumentBuilderbuild in interface DocumentBuilder<T>site - the Crafter site name the content belongs toid - value for the "localId" field in the document (final doc id is built as
site:localId)xml - the input XMLignoreRootInFieldNames - ignore the root element of the input XML in field namesDocumentBuildExceptionprotected void addCopyFields(org.dom4j.Element element)
public T build(String site, String id, Map<String,List<String>> fields)
DocumentBuilderbuild in interface DocumentBuilder<T>site - the Crafter site name the content belongs toid - value for the "localId" field in the document (final doc id is built as site:localId)fields - fields to add to solr document.protected void postProcess(T doc)
protected org.dom4j.io.SAXReader createSAXReader()
Copyright © 2019 CrafterCMS. All rights reserved.