Package org.ametys.cms.search.model
Class DefaultSearchModel
java.lang.Object
org.ametys.cms.search.model.DefaultSearchModel
- All Implemented Interfaces:
SearchModel
- Direct Known Subclasses:
DefaultSearchUIModel
Default implementation of a
SearchModel
.-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
SearchCriterion> The simple search criteria, indexed by ID.The content types of this search model.The content types excluded from this search model.protected Map<String,
SearchCriterion> The faceted search criteria, indexed by ID.protected ViewItemContainer
The result itemsprotected String
the workspace -
Constructor Summary
ConstructorDescriptionDefault constructor.DefaultSearchModel
(SearchModel searchModelToCopy, Map<String, Object> contextualParameters) Constructor by copying an existingSearchModel
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCriterion
(SearchCriterion criterion) Add a criterionvoid
addFacetedCriterion
(SearchCriterion criterion) Add a faceted criteriongetContentTypes
(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 modegetExcludedContentTypes
(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.getResultItems
(Map<String, Object> contextualParameters) Retrieves the search result itemsgetWorkspace
(Map<String, Object> contextualParameters) Get the specific workspace to use.void
setContentTypes
(Set<String> cTypes) Set the content types of the modelsvoid
setCriteria
(Collection<? extends SearchCriterion> criteria) Set the criteriavoid
setExcludedContentTypes
(Set<String> cTypes) Set the content types to excludevoid
setFacetedCriteria
(Collection<? extends SearchCriterion> criteria) Set the faceted criteriavoid
setResulItems
(ViewItemContainer resultItems) Set the result itemsvoid
setWorkspace
(String workspace) Set the workspaceMethods 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
getCriterion, getFacetedCriterion, getResultItem
-
Field Details
-
_cTypes
The content types of this search model. -
_excludedCTypes
The content types excluded from this search model. -
_criteria
The simple search criteria, indexed by ID. -
_facetedCriteria
The faceted search criteria, indexed by ID. -
_resultItems
The result items -
_workspace
the workspace
-
-
Constructor Details
-
DefaultSearchModel
public DefaultSearchModel()Default constructor. -
DefaultSearchModel
Constructor by copying an existingSearchModel
.- Parameters:
searchModelToCopy
- TheSearchModel
to copycontextualParameters
- The contextual parameters
-
-
Method Details
-
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.
-
setContentTypes
Set the content types of the models- Parameters:
cTypes
- The 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.
-
setExcludedContentTypes
Set the content types to exclude- Parameters:
cTypes
- The content types to exclude
-
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
-
addCriterion
Add a criterion- Parameters:
criterion
- the criterion to add
-
setCriteria
Set the criteria- Parameters:
criteria
- The criteria list
-
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.
-
addFacetedCriterion
Add a faceted criterion- Parameters:
criterion
- the faceted criterion to add
-
setFacetedCriteria
Set the faceted criteria- Parameters:
criteria
- The list of faceted 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
-
setResulItems
Set the result items- Parameters:
resultItems
- The result items to set
-
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.
-
setWorkspace
Set the workspace- Parameters:
workspace
- The workspace to set
-