Package org.ametys.cms.search.content
Class ContentSearcherFactory.SearchModelContentSearcher
java.lang.Object
org.ametys.cms.search.content.ContentSearcherFactory.SearchModelContentSearcher
- Enclosing class:
- ContentSearcherFactory
A ContentSearcher backed by a
SearchModel
.-
Constructor Summary
ConstructorDescriptionSearchModelContentSearcher
(SearchModel searchModel) Build a ContentSearcher referencing aSearchModel
. -
Method Summary
Modifier and TypeMethodDescriptionaddSort
(String fieldRef, Sort.Order order) Add a sort criterion.protected List<SearchField>
Get the facet fields.Get the sort criteria.<C extends Content>
AmetysObjectIterable<C>Search the contents.<C extends Content>
AmetysObjectIterable<C>Search the contents.<C extends Content>
SearchResults<C>searchWithFacets
(Map<String, Object> values) Search the contents.<C extends Content>
SearchResults<C>Search the contents.<C extends Content>
SearchResults<C>searchWithFacets
(Map<String, Object> values, Map<String, List<String>> facetValues, Map<String, Object> contextualParameters) Search the contents.setCheckRights
(boolean checkRights) Whether to check rights when searching, false otherwise.withLimits
(int start, int maxResults) Set the limits to use.withSearchMode
(String searchMode) Set the search mode.Set the sort criteria.
-
Constructor Details
-
SearchModelContentSearcher
Build a ContentSearcher referencing aSearchModel
.- Parameters:
searchModel
- theSearchModel
.
-
-
Method Details
-
addSort
Add a sort criterion.- Parameters:
fieldRef
- The field reference (name of a SearchField).order
- The sort order.- Returns:
- The ContentSearcher itself.
-
withSort
Set the sort criteria.- Parameters:
sortCriteria
- The sort criteria as a List.- Returns:
- The ContentSearcher itself.
-
withSearchMode
Set the search mode.- Parameters:
searchMode
- The search mode.- Returns:
- The ContentSearcher itself.
-
withLimits
Set the limits to use.- Parameters:
start
- The start index.maxResults
- The maximum number of results.- Returns:
- The ContentSearcher itself.
-
setCheckRights
Whether to check rights when searching, false otherwise.- Parameters:
checkRights
-true
to check rights,false
otherwise.- Returns:
- The ContentSearcher itself.
-
search
public <C extends Content> AmetysObjectIterable<C> search(Map<String, Object> values) throws ExceptionSearch the contents.- Type Parameters:
C
- The type Content- Parameters:
values
- The values for search criteria defined in the model.- Returns:
- The search results as
AmetysObject
s. - Throws:
Exception
- if an error occurs.
-
search
public <C extends Content> AmetysObjectIterable<C> search(Map<String, Object> values, Map<String, throws ExceptionObject> contextualParameters) Search the contents.- Type Parameters:
C
- The type Content- Parameters:
values
- The values for search criteria defined in the model.contextualParameters
- The search contextual parameters.- Returns:
- The search results as
AmetysObject
s. - Throws:
Exception
- if an error occurs.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(Map<String, Object> values) throws ExceptionSearch the contents.- Type Parameters:
C
- The type Content *- Parameters:
values
- The values for search criteria defined in the model.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(Map<String, Object> values, Map<String, throws ExceptionObject> contextualParameters) Search the contents.- Type Parameters:
C
- The type Content- Parameters:
values
- The values for search criteria defined in the model.contextualParameters
- The search contextual parameters.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(Map<String, Object> values, Map<String, throws ExceptionList<String>> facetValues, Map<String, Object> contextualParameters) Search the contents.- Type Parameters:
C
- The type Content- Parameters:
values
- The values for search criteria defined in the model.facetValues
- The facet values, indexedcontextualParameters
- The search contextual parameters.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
getSort
Get the sort criteria.- Parameters:
contextualParameters
- The search contextual parameters.- Returns:
- The sort criteria.
-
getFacets
Get the facet fields.- Parameters:
contextualParameters
- The search contextual parameters.- Returns:
- The facet fields as a List.
-