Class DefaultSolrDocumentBuilder
java.lang.Object
com.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder<org.apache.solr.common.SolrInputDocument>
com.broadleafcommerce.search.index.solr.document.DefaultSolrDocumentBuilder
- All Implemented Interfaces:
com.broadleafcommerce.search.index.core.document.DocumentBuilder<org.apache.solr.common.SolrInputDocument>
public class DefaultSolrDocumentBuilder
extends com.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder<org.apache.solr.common.SolrInputDocument>
-
Field Summary
FieldsFields inherited from class com.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder
LOCAL_FIELD_DEFINITION_CACHE_NAME
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSolrDocumentBuilder
(com.broadleafcommerce.search.index.core.service.IndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition> searchFieldService, com.broadleafcommerce.search.index.core.ProcessStateService processStateService, List<com.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>> contributors, List<com.broadleafcommerce.search.index.core.document.DocumentBuilderPreProcessor> preProcessors, com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.search.index.core.document.helper.DocumentBuilderHelper documentBuilderHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildId
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Build an ID value which routes documents based on context ID and is a unique representation of its context.protected org.apache.solr.common.SolrInputDocument
createDocument
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Creates an emptySolrInputDocument
, except for theIndexableType
and ID fields, which are required and which will be populated.protected String
getCatalogId
(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) Retrieve the catalog ID from this ContextState.protected com.broadleafcommerce.search.index.core.document.helper.DocumentBuilderHelper
protected com.broadleafcommerce.search.provider.solr.SolrFieldService
protected String
idMapEntryToString
(Map.Entry<String, Object> entry) Convert an ID map entry into a String format for concatenation into a compound ID.protected boolean
isEmptyOrNull
(Object value) protected void
populateDocument
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, org.apache.solr.common.SolrInputDocument solrInputDocument, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fields, com.jayway.jsonpath.DocumentContext context) Methods inherited from class com.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder
buildDocuments, executeContributors, executePreProcessors, getContributorsForIndexableType, getDefaultContributors, getDefaultJsonPathConfiguration, getIndexableTypeContributors, getJsonPathConfiguration, getLocalFieldDefCacheSize, getPreProcessors, getProcessStateService, getSearchFieldService, readFieldsForIndexable, shouldIndex
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.search.index.core.document.DocumentBuilder
buildDocuments
-
Field Details
-
DEFAULT_TYPE_FIELD_NAME
- See Also:
-
-
Constructor Details
-
DefaultSolrDocumentBuilder
public DefaultSolrDocumentBuilder(com.broadleafcommerce.search.index.core.service.IndexerSearchService<com.broadleafcommerce.search.api.domain.FieldDefinition> searchFieldService, com.broadleafcommerce.search.index.core.ProcessStateService processStateService, List<com.broadleafcommerce.search.index.core.document.DocumentBuilderContributor<org.apache.solr.common.SolrInputDocument>> contributors, List<com.broadleafcommerce.search.index.core.document.DocumentBuilderPreProcessor> preProcessors, com.broadleafcommerce.search.provider.solr.SolrFieldService solrFieldService, com.broadleafcommerce.search.index.core.document.helper.DocumentBuilderHelper documentBuilderHelper)
-
-
Method Details
-
createDocument
protected org.apache.solr.common.SolrInputDocument createDocument(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Creates an emptySolrInputDocument
, except for theIndexableType
and ID fields, which are required and which will be populated. The default behavior is to use the context ID as part of the ID field. The other part of the ID field will be a unique representation of its context.- Specified by:
createDocument
in classcom.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder<org.apache.solr.common.SolrInputDocument>
- Parameters:
indexable
- The indexable to create a document for- Returns:
- SolrInputDocument with id, indexable type, and contextId
-
buildId
Build an ID value which routes documents based on context ID and is a unique representation of its context.Indexables with the same context ID, catalog, sandbox, and sandbox owner context should produce the same ID.
- Specified by:
buildId
in classcom.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder<org.apache.solr.common.SolrInputDocument>
- Parameters:
indexable
- The indexable to create an ID for- Returns:
- an ID unique by indexable context id, catalog, sandbox, and sandbox owner
-
getCatalogId
protected String getCatalogId(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState) Retrieve the catalog ID from this ContextState. Takes into account catalog overrides.- Parameters:
contextState
- The context state of a CatalogTrackable indexable- Returns:
- The catalog ID for this catalog trackable.
-
idMapEntryToString
Convert an ID map entry into a String format for concatenation into a compound ID.- Parameters:
entry
- entry in ID map- Returns:
- entry in format "key=value" to be added to a compound ID
-
populateDocument
protected void populateDocument(com.broadleafcommerce.search.api.domain.Indexable<?> indexable, org.apache.solr.common.SolrInputDocument solrInputDocument, List<com.broadleafcommerce.search.api.domain.FieldDefinition> fields, com.jayway.jsonpath.DocumentContext context) - Specified by:
populateDocument
in classcom.broadleafcommerce.search.index.core.document.AbstractDocumentBuilder<org.apache.solr.common.SolrInputDocument>
-
isEmptyOrNull
-
getSolrFieldService
protected com.broadleafcommerce.search.provider.solr.SolrFieldService getSolrFieldService() -
getDocumentBuilderHelper
protected com.broadleafcommerce.search.index.core.document.helper.DocumentBuilderHelper getDocumentBuilderHelper()
-