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
ConstructorsConstructorDescriptionSearchModelContentSearcher(SearchModel searchModel) Build a ContentSearcher referencing aSearchModel. -
Method Summary
Modifier and TypeMethodDescriptionAdd a sort criterion.<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.withHighlightingQuery(Query query) Set the highlight to use.withLimits(int start, int maxResults) Set the limits to use.withSearchMode(String searchMode) Set the search mode.withSort(List<ContentSearcherFactory.ContentSearchSort> sortCriteria) 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
public ContentSearcherFactory.SearchModelContentSearcher withSort(List<ContentSearcherFactory.ContentSearchSort> sortCriteria) 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.
-
withHighlightingQuery
Set the highlight to use.- Parameters:
query- the highlighting query- Returns:
- The ContentSearcher itself.
-
setCheckRights
Whether to check rights when searching, false otherwise.- Parameters:
checkRights-trueto check rights,falseotherwise.- 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 criteria defined in the model.- Returns:
- The search results as
AmetysObjects. - 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 criteria defined in the model.contextualParameters- The search contextual parameters.- Returns:
- The search results as
AmetysObjects. - 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 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 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 criteria defined in the model.facetValues- The facet values, indexedcontextualParameters- The search contextual parameters.- Returns:
- The search results.
- Throws:
Exception- if an error occurs.
-