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
FieldsModifier and TypeFieldDescriptionprotected LoggerThe logger.protected ThreadSafeComponentManager<SearchCriterion>ComponentManager forSearchUICriterions. -
Constructor Summary
ConstructorsConstructorDescriptionCriteriaSearchModelWrapper(SearchModel model, ServiceManager manager, Context context, Logger logger) Build a model wrapper. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddIndexingFieldCriteriaComponents(List<Object> searchToolCriterionRoles, Set<String> baseContentTypeIds, String fieldRef) Add a indexing field criteria component to the manager.protected voidaddSystemCriteriaComponents(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 SearchCriteriongetCriterion(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 LoggerGet 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.voidCalled at creation time to provide aLogger.voidsetResultColumns(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, waitMethods inherited from interface org.ametys.cms.search.model.SearchModel
getFacetedCriterion
-
Field Details
-
_searchCriterionManager
ComponentManager forSearchUICriterions. -
_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:LogEnabledCalled at creation time to provide aLogger.- Specified by:
setLoggerin interfaceLogEnabled- Parameters:
logger- aLoggerfor 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:SearchModelGet the list of faceted search criteria.- Specified by:
getFacetedCriteriain interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of faceted search criteria.
-
getResultItems
Description copied from interface:SearchModelRetrieves the search result items- Specified by:
getResultItemsin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the search result items
-
getResultItem
Description copied from interface:SearchModelRetrieves the search result item with the given path- Specified by:
getResultItemin 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:SearchModelGet the list of content types.- Specified by:
getContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- The list of content types.
-
getExcludedContentTypes
Description copied from interface:SearchModelGet the list of excluded content types.- Specified by:
getExcludedContentTypesin interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- The list of excluded content types.
-
getCriteria
Description copied from interface:SearchModelGet the list of search criteria in simple mode- Specified by:
getCriteriain interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters- Returns:
- the list of search criteria in simple mode
-
getCriterion
Description copied from interface:SearchModelGet a simple search criterion by its id- Specified by:
getCriterionin interfaceSearchModel- Parameters:
id- The search criterion idcontextualParameters- the contextual parameters- Returns:
- the criterion or
nullif not found
-
getWorkspace
Description copied from interface:SearchModelGet the specific workspace to use.- Specified by:
getWorkspacein interfaceSearchModel- Parameters:
contextualParameters- the contextual parameters.- Returns:
- the workspace to use when searching, or null to use the default workspace.
-