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
|
private QueryBuilder |
_queryBuilder |
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) List<ExtractionClauseGroup> |
_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 Iterable<Content> |
getContents(ExtractionExecutionContext context)
Gets the content results from Solr
|
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(Iterable<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, setTagName
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private 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
private QueryBuilder _queryBuilder
public AbstractSolrExtractionComponent()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class AbstractExtractionComponent
ServiceException
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
configure
in class AbstractExtractionComponent
ConfigurationException
public void prepareComponentExecution(ExtractionExecutionContext context) throws Exception
ExtractionComponent
prepareComponentExecution
in interface ExtractionComponent
prepareComponentExecution
in class AbstractExtractionComponent
context
- 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)
List<ExtractionClauseGroup> _extractGroupExpressionsFromClause(String expression)
List<String> _extractVariableFromClauseExpression(String expression)
public void executeComponent(ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception
AbstractExtractionComponent
executeComponent
in class AbstractExtractionComponent
contentHandler
- 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 Iterable<Content> getContents(ExtractionExecutionContext context) throws Exception
context
- component execution contextException
- if an error occursprotected abstract void processContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception
contents
- search resultscontentHandler
- result documentcontext
- component execution contextException
- if an error occurspublic Map<String,Object> getComponentDetailsForTree()
ExtractionComponent
getComponentDetailsForTree
in interface ExtractionComponent
getComponentDetailsForTree
in class AbstractExtractionComponent
Map
containing component detailspublic Set<String> getContentTypes()
ExtractionComponent
public 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