Package org.ametys.cms.search.content
Class ContentSearcherFactory.SearchModelContentSearcher
- java.lang.Object
-
- org.ametys.cms.search.content.ContentSearcherFactory.SearchModelContentSearcher
-
- Enclosing class:
- ContentSearcherFactory
public class ContentSearcherFactory.SearchModelContentSearcher extends Object
A ContentSearcher backed by aSearchModel
.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_checkRights
private int
_maxResults
private String
_searchMode
private SearchUIModel
_searchModel
private List<Sort>
_sort
private int
_start
-
Constructor Summary
Constructors Constructor Description SearchModelContentSearcher(SearchModel searchModel)
Build a ContentSearcher referencing aSearchModel
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private SearcherFactory.Searcher
_searcher(Map<String,Object> values, Map<String,List<String>> facetValues, Map<String,Object> contextualParameters)
ContentSearcherFactory.SearchModelContentSearcher
addSort(String fieldRef, Sort.Order order)
Add a sort criterion.protected List<SearchField>
getFacets(Map<String,Object> contextualParameters)
Get the facet fields.protected List<Sort>
getSort(Map<String,Object> contextualParameters)
Get the sort criteria.<C extends Content>
AmetysObjectIterable<C>search(Map<String,Object> values)
Search the contents.<C extends Content>
SearchResults<C>searchWithFacets(Map<String,Object> values)
Search the contents.<C extends Content>
SearchResults<C>searchWithFacets(Map<String,Object> values, Map<String,Object> contextualParameters)
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.ContentSearcherFactory.SearchModelContentSearcher
setCheckRights(boolean checkRights)
Whether to check rights when searching, false otherwise.ContentSearcherFactory.SearchModelContentSearcher
withLimits(int start, int maxResults)
Set the limits to use.ContentSearcherFactory.SearchModelContentSearcher
withSearchMode(String searchMode)
Set the search mode.ContentSearcherFactory.SearchModelContentSearcher
withSort(List<Sort> sortCriteria)
Set the sort criteria.
-
-
-
Field Detail
-
_searchModel
private SearchUIModel _searchModel
-
_searchMode
private String _searchMode
-
_start
private int _start
-
_maxResults
private int _maxResults
-
_checkRights
private boolean _checkRights
-
-
Constructor Detail
-
SearchModelContentSearcher
public SearchModelContentSearcher(SearchModel searchModel)
Build a ContentSearcher referencing aSearchModel
.- Parameters:
searchModel
- theSearchModel
.
-
-
Method Detail
-
addSort
public ContentSearcherFactory.SearchModelContentSearcher addSort(String fieldRef, Sort.Order order)
Add a sort criterion.- Parameters:
fieldRef
- The field reference (name of a SearchField).order
- The sort order.- Returns:
- The ContentSearcher itself.
-
withSort
public ContentSearcherFactory.SearchModelContentSearcher withSort(List<Sort> sortCriteria)
Set the sort criteria.- Parameters:
sortCriteria
- The sort criteria as a List.- Returns:
- The ContentSearcher itself.
-
withSearchMode
public ContentSearcherFactory.SearchModelContentSearcher withSearchMode(String searchMode)
Set the search mode.- Parameters:
searchMode
- The search mode.- Returns:
- The ContentSearcher itself.
-
withLimits
public ContentSearcherFactory.SearchModelContentSearcher withLimits(int start, int maxResults)
Set the limits to use.- Parameters:
start
- The start index.maxResults
- The maximum number of results.- Returns:
- The ContentSearcher itself.
-
setCheckRights
public ContentSearcherFactory.SearchModelContentSearcher setCheckRights(boolean checkRights)
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 Exception
Search 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.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(Map<String,Object> values) throws Exception
Search 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,Object> contextualParameters) throws Exception
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,List<String>> facetValues, Map<String,Object> contextualParameters) throws Exception
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.
-
_searcher
private SearcherFactory.Searcher _searcher(Map<String,Object> values, Map<String,List<String>> facetValues, Map<String,Object> contextualParameters)
-
getSort
protected List<Sort> getSort(Map<String,Object> contextualParameters)
Get the sort criteria.- Parameters:
contextualParameters
- The search contextual parameters.- Returns:
- The sort criteria.
-
-