Class AbstractSolrExtractionComponent
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.extraction.component.AbstractExtractionComponent
org.ametys.plugins.extraction.component.AbstractSolrExtractionComponent
- All Implemented Interfaces:
ExtractionComponent
,Configurable
,LogEnabled
,Serviceable
- Direct Known Subclasses:
AbstractGroupExtractionComponent
,MappingQueryExtractionComponent
This class represents an extraction component with a solr query
-
Field Summary
Modifier and TypeFieldDescriptionprotected List<ExtractionClause>
The list of clausesContent types concerned by the solr searchprotected GetQueryFromJSONHelper
Helper to resolve referenced query infosprotected JSONUtils
Util class to manipulate JSON Stringprotected String
Reference id of a recorded queryFields inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
_contentTypeExtensionPoint, _contentTypesHelper, _subComponents, _tagName, _thesaurusDAO, EXTRACTION_ITEM_PATH_SEPARATOR, JOIN_HIERARCHY_ELEMENT, JOIN_HIERARCHY_SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getAttributeTypeId
(String fieldPath, Collection<String> contentTypeIds) Retrieves the field path's attribute type identifier from content typesvoid
addClauses
(String... expressions) Add clauses to the component.void
addContentTypes
(String... contentTypes) Add content types to componentprotected void
computeReferencedQueryInfos
(String refQueryContent) Manages the stored query referenced by the componentvoid
configure
(Configuration configuration) void
executeComponent
(ContentHandler contentHandler, ExtractionExecutionContext context) Execute the extraction of the componentRetrieves the component clausesRetrieves the details of the component for treegetContents
(ExtractionExecutionContext context) Gets the content results from SolrRetrieves the content searcher to use for solr searchRetrieves the list of content types defined for this componentRetrieves the id of the referenced queryvoid
Prepare the execution of the componentprotected abstract void
processContents
(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) Process result contents to format the result documentvoid
service
(ServiceManager serviceManager) void
setQueryReferenceId
(String queryReferenceId) Sets the id of the referenced queryMethods inherited from class org.ametys.plugins.extraction.component.AbstractExtractionComponent
addSubComponent, execute, executeSubComponents, getDefaultTagName, getLogsPrefix, getSubComponents, getTagName, setTagName
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_contentTypes
Content types concerned by the solr search -
_queryReferenceId
Reference id of a recorded query -
_clauses
The list of clauses -
_getQueryFromJSONHelper
Helper to resolve referenced query infos -
_jsonUtils
Util class to manipulate JSON String
-
-
Constructor Details
-
AbstractSolrExtractionComponent
public AbstractSolrExtractionComponent()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractExtractionComponent
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractExtractionComponent
- Throws:
ConfigurationException
-
prepareComponentExecution
Description copied from interface:ExtractionComponent
Prepare the execution of the component- Specified by:
prepareComponentExecution
in interfaceExtractionComponent
- Overrides:
prepareComponentExecution
in classAbstractExtractionComponent
- Parameters:
context
- context of the extraction component- Throws:
Exception
- if an error occurs
-
computeReferencedQueryInfos
Manages the stored query referenced by the component- Parameters:
refQueryContent
- referenced query content- Throws:
QuerySyntaxException
- if there is a syntax error in the referenced query
-
executeComponent
public void executeComponent(ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception Description copied from class:AbstractExtractionComponent
Execute the extraction of the component- Specified by:
executeComponent
in classAbstractExtractionComponent
- Parameters:
contentHandler
- result documentcontext
- context of the extraction component- Throws:
Exception
- if an error occurs
-
_getAttributeTypeId
Retrieves the field path's attribute type identifier from content types- Parameters:
fieldPath
- the field pathcontentTypeIds
- the content types identifiers- Returns:
- the attribute type identifier
-
getContentSearcher
Retrieves the content searcher to use for solr search- Returns:
- the content searcher
-
getContents
Gets the content results from Solr- Parameters:
context
- component execution context- Returns:
- the content results from Solr
- Throws:
Exception
- if an error occurs
-
processContents
protected abstract void processContents(Iterable<Content> contents, ContentHandler contentHandler, ExtractionExecutionContext context) throws Exception Process result contents to format the result document- Parameters:
contents
- search resultscontentHandler
- result documentcontext
- component execution context- Throws:
Exception
- if an error occurs
-
getComponentDetailsForTree
Description copied from interface:ExtractionComponent
Retrieves the details of the component for tree- Specified by:
getComponentDetailsForTree
in interfaceExtractionComponent
- Overrides:
getComponentDetailsForTree
in classAbstractExtractionComponent
- Returns:
- a
Map
containing component details
-
getContentTypes
Description copied from interface:ExtractionComponent
Retrieves the list of content types defined for this component- Returns:
- a list of content types id
-
addContentTypes
Add content types to component- Parameters:
contentTypes
- Array of content types to add
-
getQueryReferenceId
Retrieves the id of the referenced query- Returns:
- the id of the referenced query
-
setQueryReferenceId
Sets the id of the referenced query- Parameters:
queryReferenceId
- The id of the referenced query to set
-
getClauses
Retrieves the component clauses- Returns:
- the component clauses
-
addClauses
Add clauses to the component. Do not manage clauses' groups- Parameters:
expressions
- Array clauses expressions to add
-