public class SolrDocumentBuilder extends Object
<page>
<file-name>index.xml</file-name>
<showAboutAuthor>false</showAboutAuthor>
<showSearchBox>true</showSearchBox>
</page>
into a Solr Document:
<add>
<doc>
<field name="file-name">index.xml</field>
<field name="showAboutAuthor">false</field>
<field name="showSearchBox">true</field>
</doc>
</add>
The Solr document is represent in Java as a SolrInputDocument object, which then can be sent to the server
with
SolrServer.add(org.apache.solr.common.SolrInputDocument)
| Modifier and Type | Field and Description |
|---|---|
protected String |
dateTimeFieldPattern |
protected String |
dateTimeFieldSuffix |
protected String |
htmlFieldSuffix |
protected String |
localIdFieldName |
protected String |
siteFieldName |
| Constructor and Description |
|---|
SolrDocumentBuilder() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
build(org.apache.solr.common.SolrInputDocument solrDoc,
String branchName,
org.dom4j.Element element) |
org.apache.solr.common.SolrInputDocument |
build(String site,
String id,
String xml,
boolean ignoreRootInFieldNames)
Build the Solr document from the input XML.
|
protected String |
convertToISODateTimeString(String dateTimeStr) |
protected org.dom4j.io.SAXReader |
createSAXReader() |
void |
init() |
void |
setDateTimeFieldPattern(String dateTimeFieldPattern)
Sets the pattern string for datetime fields tha come in the input XML.
|
void |
setDateTimeFieldSuffix(String dateTimeFieldSuffix)
Sets the suffix of datetime fields (commonly _dt).
|
void |
setHtmlFieldSuffix(String htmlFieldSuffix)
Sets the suffix of fields with HTML content (commonly _html).
|
void |
setLocalIdFieldName(String localIdFieldName)
Sets the local ID field name, which is the ID of the document within the site.
|
void |
setSiteFieldName(String siteFieldName)
Sets the site field name, which is used to indicate to which site the document belongs to.
|
protected String |
stripHtml(String element,
String value) |
protected String siteFieldName
protected String localIdFieldName
protected String dateTimeFieldPattern
protected String dateTimeFieldSuffix
protected String htmlFieldSuffix
public void setSiteFieldName(String siteFieldName)
public void setLocalIdFieldName(String localIdFieldName)
public void setDateTimeFieldPattern(String dateTimeFieldPattern)
public void setDateTimeFieldSuffix(String dateTimeFieldSuffix)
public void setHtmlFieldSuffix(String htmlFieldSuffix)
@PostConstruct public void init()
public org.apache.solr.common.SolrInputDocument build(String site, String id, String xml, boolean ignoreRootInFieldNames) throws SolrDocumentBuildException
site - the Crafter site name the content belongs toid - value for the "localId" field in the Solr document (final doc id is built as
site:localId)xml - the input XMLignoreRootInFieldNames - ignore the root element of the input XML in field namesSolrDocumentBuildExceptionprotected void build(org.apache.solr.common.SolrInputDocument solrDoc,
String branchName,
org.dom4j.Element element)
protected org.dom4j.io.SAXReader createSAXReader()
protected String stripHtml(String element, String value) throws SolrDocumentBuildException
SolrDocumentBuildExceptionCopyright © 2013 CrafterCMS. All Rights Reserved.