Package org.ametys.cms.search.solr
Class CriteriaSearchModelWrapper
java.lang.Object
org.ametys.cms.search.solr.CriteriaSearchModelWrapper
- All Implemented Interfaces:
SearchModel
,LogEnabled
Search model wrapper which handles custom on-the-fly columns and facets.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Logger
The logger.protected ThreadSafeComponentManager<SearchCriterion>
ComponentManager forSearchUICriterion
s. -
Constructor Summary
ConstructorDescriptionCriteriaSearchModelWrapper
(SearchModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addIndexingFieldCriteriaComponents
(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef) Add a indexing field criteria component to the manager.protected void
addSystemCriteriaComponents
(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String property) Add a system criteria component to the manager.protected Collection<String>
configureFacets
(List<Object> criteriaRoles, Set<String> baseContentTypeIds, Collection<String> criteriaIds, SearchModel referenceModel, Map<String, Object> contextualParameters) Configure the list of faceted criteria.getContentTypes
(Map<String, Object> contextualParameters) Get the list of content types.Map<String,
? extends SearchCriterion> getCriteria
(Map<String, Object> contextualParameters) Get the list of search criteria in simple modegetCriterion
(String id, Map<String, Object> contextualParameters) Get a simple search criterion by its idprotected SearchCriterion
getCriterion
(SearchModel searchModel, String criterionId, Map<String, Object> contextualParameters) Search a criterion in the reference model from its criterion identifier.getExcludedContentTypes
(Map<String, Object> contextualParameters) Get the list of excluded content types.Map<String,
? extends SearchCriterion> getFacetedCriteria
(Map<String, Object> contextualParameters) Get the list of faceted search criteria.protected final Logger
Get the logger.getResultItem
(String itemPath, Map<String, Object> contextualParameters) Retrieves the search result item with the given pathgetResultItems
(Map<String, Object> contextualParameters) Retrieves the search result itemsgetWorkspace
(Map<String, Object> contextualParameters) Get the specific workspace to use.setFacetedCriteria
(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String, Object> contextualParameters) Set the custom faceted criteria.void
Called at creation time to provide aLogger
.void
setResultColumns
(Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columns, Map<String, Object> contextualParameters) Set the custom columns.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.cms.search.model.SearchModel
getFacetedCriterion
-
Field Details
-
_searchCriterionManager
ComponentManager forSearchUICriterion
s. -
_logger
The logger.
-
-
Constructor Details
-
CriteriaSearchModelWrapper
public CriteriaSearchModelWrapper(SearchModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper.- Parameters:
model
- the search model to wrap.manager
- the service manager.context
- the component context.logger
- the logger.
-
-
Method Details
-
setLogger
Description copied from interface:LogEnabled
Called at creation time to provide aLogger
.- Specified by:
setLogger
in interfaceLogEnabled
- Parameters:
logger
- aLogger
for messages.
-
getLogger
Get the logger.- Returns:
- the logger.
-
setFacetedCriteria
public Collection<String> setFacetedCriteria(Set<String> baseContentTypeIds, Collection<String> criteriaIds, Map<String, Object> contextualParameters) throws ExceptionSet the custom faceted criteria.- Parameters:
baseContentTypeIds
- the reference content type identifiers.criteriaIds
- the criteria IDscontextualParameters
- the contextual parameters- Returns:
- the valid criteria IDs
- Throws:
Exception
- if an error occurs initializing criteria.
-
setResultColumns
public void setResultColumns(Set<String> baseContentTypeIds, Collection<ColumnHelper.Column> columns, Map<String, Object> contextualParameters) throws ExceptionSet the custom columns.- Parameters:
baseContentTypeIds
- the reference content type identifiers.columns
- The columnscontextualParameters
- the contextual parameters- Throws:
Exception
- if an error occurs initializing columns.
-
configureFacets
protected Collection<String> configureFacets(List<Object> criteriaRoles, Set<String> baseContentTypeIds, Collection<String> criteriaIds, SearchModel referenceModel, Map<String, Object> contextualParameters) throws ConfigurationExceptionConfigure the list of faceted criteria.- Parameters:
criteriaRoles
- the roles of criteria to lookup (or the already existing SearchUICriterion objects).baseContentTypeIds
- The reference content type identifiers.criteriaIds
- the criteria IDs.referenceModel
- the reference model.contextualParameters
- the contextual parameters- Returns:
- the valid criteria IDs
- Throws:
ConfigurationException
- if an error occurs creating a component configuration.
-
getCriterion
protected SearchCriterion getCriterion(SearchModel searchModel, String criterionId, Map<String, Object> contextualParameters) Search a criterion in the reference model from its criterion identifier.- Parameters:
searchModel
- the reference search model.criterionId
- the criterion identifier.contextualParameters
- the contextual parameters- Returns:
- the criterion if found, null otherwise.
-
addIndexingFieldCriteriaComponents
protected void addIndexingFieldCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef) throws ConfigurationException Add a indexing field criteria component to the manager.- Parameters:
searchToolCriterionRoles
- the criteria role list to fill.baseContentTypeIds
- the reference content type identifiers.fieldRef
- the field path.- Throws:
ConfigurationException
- if an error occurs.
-
addSystemCriteriaComponents
protected void addSystemCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String property) throws ConfigurationException Add a system criteria component to the manager.- Parameters:
searchToolCriterionRoles
- the criteria role list to fill.baseContentTypeIds
- the reference content type identifiers.property
- the system property id.- Throws:
ConfigurationException
- if an error occurs.
-
getFacetedCriteria
public Map<String,? extends SearchCriterion> getFacetedCriteria(Map<String, Object> contextualParameters) Description copied from interface:SearchModel
Get the list of faceted search criteria.- Specified by:
getFacetedCriteria
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the list of faceted search criteria.
-
getResultItems
Description copied from interface:SearchModel
Retrieves the search result items- Specified by:
getResultItems
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the search result items
-
getResultItem
Description copied from interface:SearchModel
Retrieves the search result item with the given path- Specified by:
getResultItem
in interfaceSearchModel
- Parameters:
itemPath
- the path of the result item to retrievecontextualParameters
- the contextual parameters- Returns:
- the search result item with
-
getContentTypes
Description copied from interface:SearchModel
Get the list of content types.- Specified by:
getContentTypes
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters.- Returns:
- The list of content types.
-
getExcludedContentTypes
Description copied from interface:SearchModel
Get the list of excluded content types.- Specified by:
getExcludedContentTypes
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- The list of excluded content types.
-
getCriteria
Description copied from interface:SearchModel
Get the list of search criteria in simple mode- Specified by:
getCriteria
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters- Returns:
- the list of search criteria in simple mode
-
getCriterion
Description copied from interface:SearchModel
Get a simple search criterion by its id- Specified by:
getCriterion
in interfaceSearchModel
- Parameters:
id
- The search criterion idcontextualParameters
- the contextual parameters- Returns:
- the criterion or
null
if not found
-
getWorkspace
Description copied from interface:SearchModel
Get the specific workspace to use.- Specified by:
getWorkspace
in interfaceSearchModel
- Parameters:
contextualParameters
- the contextual parameters.- Returns:
- the workspace to use when searching, or null to use the default workspace.
-