public abstract class AbstractSolrExtractionComponent extends AbstractExtractionComponent
| Modifier and Type | Field and Description |
|---|---|
protected List<ExtractionClause> |
_clauses
The list of clauses
|
private ContentHelper |
_contentHelper |
private ContentSearcherFactory |
_contentSearcherFactory |
protected Set<String> |
_contentTypes
Content types concerned by the solr search
|
protected GetQueryFromJSONHelper |
_getQueryFromJSONHelper
Helper to resolve referenced query infos
|
protected JSONUtils |
_jsonUtils
Util class to manipulate JSON String
|
protected String |
_queryReferenceId
Reference id of a recorded query
|
private AmetysObjectResolver |
_resolver |
private SystemPropertyExtensionPoint |
_systemPropertyExtensionPoint |
private static String |
EXTRACT_JOIN_VARIABLES_REGEX
Regex used to extract variables from a join expression: \$\{(\.\.(?:\/\.\.)*(?:\/[^\/}]+)?)\}
a variable is inside a ${}
variable starts with ..
|
_contentTypeExtensionPoint, _contentTypesHelper, _subComponents, _tagName, _thesaurusDAO, EXTRACTION_METADATA_PATH_SEPARATOR, JOIN_HIERARCHY_ELEMENT, JOIN_HIERARCHY_SEPARATOR| Constructor and Description |
|---|
AbstractSolrExtractionComponent() |
| Modifier and Type | Method and Description |
|---|---|
private void |
_computeClausesInfos(ExtractionExecutionContext context) |
(package private) Map<String,String> |
_extractGroupExpressionsFromClause(String expression) |
(package private) List<String> |
_extractVariableFromClauseExpression(String expression) |
(package private) List<String> |
_getClauseQueries(ExtractionExecutionContext context) |
private Object |
_getContentValue(Content content,
String fieldPath,
Locale defaultLocale) |
private Collection<Object> |
_getContentValuesFromVariable(Content content,
String fieldPath,
MetadataType metadataType,
boolean isAutoposting,
Locale defaultLocale) |
private ExtractionExecutionContextHierarchyElement |
_getCurrentContextElementFromVariable(String variable,
List<ExtractionExecutionContextHierarchyElement> context) |
protected MetadataType |
_getMetadataType(String fieldPath,
Collection<String> contentTypes)
Retrieves the field path's metadata type from content types
|
private String |
_getValueAsString(Object value,
MetadataType metadataType,
String fieldPath) |
private Collection<Object> |
_getValuesFromVariable(String fieldPath,
MetadataType metadataType,
ExtractionExecutionContextHierarchyElement contextHierarchyElement,
Locale defaultLocale) |
private boolean |
_hasVariablesOutsideGroups(String clauseExpression,
Collection<String> groupExpressions) |
private String |
_resolveExpression(String expression,
Map<String,String> queryVariables) |
void |
addClauses(String... expressions)
Add clauses to the component.
|
void |
addContentTypes(String... contentTypes)
Add content types to component
|
protected void |
computeReferencedQueryInfos(String refQueryContent)
Manages the stored query referenced by the component
|
void |
configure(Configuration configuration) |
void |
executeComponent(ContentHandler contentHandler,
ExtractionExecutionContext context)
Execute the extraction of the component
|
List<ExtractionClause> |
getClauses()
Retrieves the component clauses
|
Map<String,Object> |
getComponentDetailsForTree()
Retrieves the details of the component for tree
|
protected ContentSearcherFactory.SimpleContentSearcher |
getContentSearcher()
Retrieves the content searcher to use for solr search
|
Set<String> |
getContentTypes()
Retrieves the list of content types defined for this component
|
String |
getQueryReferenceId()
Retrieves the id of the referenced query
|
void |
prepareComponentExecution(ExtractionExecutionContext context)
Prepare the execution of the component
|
protected abstract void |
processContents(AmetysObjectIterable<Content> contents,
ContentHandler contentHandler,
ExtractionExecutionContext context)
Process result contents to format the result document
|
void |
service(ServiceManager serviceManager) |
void |
setQueryReferenceId(String queryReferenceId)
Sets the id of the referenced query
|
addSubComponent, execute, executeSubComponents, getDefaultTagName, getLogsPrefix, getSubComponents, getTagName, setTagNameenableLogging, getLogger, setupLogger, setupLogger, setupLoggerprivate static final String EXTRACT_JOIN_VARIABLES_REGEX
protected Set<String> _contentTypes
protected String _queryReferenceId
protected List<ExtractionClause> _clauses
protected GetQueryFromJSONHelper _getQueryFromJSONHelper
protected JSONUtils _jsonUtils
private AmetysObjectResolver _resolver
private SystemPropertyExtensionPoint _systemPropertyExtensionPoint
private ContentHelper _contentHelper
private ContentSearcherFactory _contentSearcherFactory
public AbstractSolrExtractionComponent()
public void service(ServiceManager serviceManager) throws ServiceException
service in interface Serviceableservice in class AbstractExtractionComponentServiceExceptionpublic void configure(Configuration configuration) throws ConfigurationException
configure in interface Configurableconfigure in class AbstractExtractionComponentConfigurationExceptionpublic void prepareComponentExecution(ExtractionExecutionContext context) throws Exception
ExtractionComponentprepareComponentExecution in interface ExtractionComponentprepareComponentExecution in class AbstractExtractionComponentcontext - context of the extraction componentException - if an error occursprotected void computeReferencedQueryInfos(String refQueryContent) throws QuerySyntaxException
refQueryContent - referenced query contentQuerySyntaxException - if there is a syntax error in the referenced queryprivate void _computeClausesInfos(ExtractionExecutionContext context)
private String _resolveExpression(String expression, Map<String,String> queryVariables)
private boolean _hasVariablesOutsideGroups(String clauseExpression, Collection<String> groupExpressions)
Map<String,String> _extractGroupExpressionsFromClause(String expression)
List<String> _extractVariableFromClauseExpression(String expression)
public void executeComponent(ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception
AbstractExtractionComponentexecuteComponent in class AbstractExtractionComponentcontentHandler - result documentcontext - context of the extraction componentException - if an error occursList<String> _getClauseQueries(ExtractionExecutionContext context)
private ExtractionExecutionContextHierarchyElement _getCurrentContextElementFromVariable(String variable, List<ExtractionExecutionContextHierarchyElement> context)
protected MetadataType _getMetadataType(String fieldPath, Collection<String> contentTypes)
fieldPath - the field pathcontentTypes - the content typesprivate Collection<Object> _getValuesFromVariable(String fieldPath, MetadataType metadataType, ExtractionExecutionContextHierarchyElement contextHierarchyElement, Locale defaultLocale)
private Collection<Object> _getContentValuesFromVariable(Content content, String fieldPath, MetadataType metadataType, boolean isAutoposting, Locale defaultLocale)
private Object _getContentValue(Content content, String fieldPath, Locale defaultLocale)
private String _getValueAsString(Object value, MetadataType metadataType, String fieldPath)
protected ContentSearcherFactory.SimpleContentSearcher getContentSearcher()
protected abstract void processContents(AmetysObjectIterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception
contents - search resultscontentHandler - result documentcontext - component execution contextException - if an error occurspublic Map<String,Object> getComponentDetailsForTree()
ExtractionComponentgetComponentDetailsForTree in interface ExtractionComponentgetComponentDetailsForTree in class AbstractExtractionComponentMap containing component detailspublic Set<String> getContentTypes()
ExtractionComponentpublic void addContentTypes(String... contentTypes)
contentTypes - Array of content types to addpublic String getQueryReferenceId()
public void setQueryReferenceId(String queryReferenceId)
queryReferenceId - The id of the referenced query to setpublic List<ExtractionClause> getClauses()
public void addClauses(String... expressions)
expressions - Array clauses expressions to add