Package org.ametys.cms.search.content
Class ContentSearcherFactory.SimpleContentSearcher
java.lang.Object
org.ametys.cms.search.content.ContentSearcherFactory.SimpleContentSearcher
- Enclosing class:
- ContentSearcherFactory
A ContentSearcher on a list of content types.
-
Constructor Summary
ConstructorDescriptionSimpleContentSearcher
(Collection<String> contentTypes) Build a content searcher on a list of content types. -
Method Summary
Modifier and TypeMethodDescriptionaddSort
(String fieldRef, Sort.Order order) Add a sort criterion.protected List<SearchField>
Get the facet criteria as a list of SearchField from the specified field names.getSort()
Get the sort criteria from the specified field names.<C extends Content>
AmetysObjectIterable<C>Search the contents.<C extends Content>
AmetysObjectIterable<C>Search the contents.<C extends Content>
SearchResults<C>searchWithFacets
(String query) Search the contents.<C extends Content>
SearchResults<C>Search the contents.<C extends Content>
SearchResults<C>searchWithFacets
(Query query) Search the contents.<C extends Content>
SearchResults<C>Search the contents.setCheckRights
(boolean checkRights) Whether to check rights when searching, false otherwise.withFacets
(String... facets) Set the facets.withFacets
(Collection<String> facets) Set the facets.withFilterQueries
(List<Query> filterQueries) Set the filter queries.withFilterQueryStrings
(List<String> filterQueryStrings) Set the filter queries.withLimits
(int start, int maxResults) Set the limits to use.Set the sort criteria.
-
Constructor Details
-
SimpleContentSearcher
Build a content searcher on a list of content types.- Parameters:
contentTypes
- A collection of content types to search on.
-
-
Method Details
-
withFilterQueries
Set the filter queries.- Parameters:
filterQueries
- the filter queries.- Returns:
- The ContentSearcher itself.
-
withFilterQueryStrings
public ContentSearcherFactory.SimpleContentSearcher withFilterQueryStrings(List<String> filterQueryStrings) Set the filter queries.- Parameters:
filterQueryStrings
- the filter queries.- Returns:
- The ContentSearcher itself.
-
withSort
Set the sort criteria.- Parameters:
sortCriteria
- The sort criteria as a List.- Returns:
- The ContentSearcher itself.
-
addSort
Add a sort criterion.- Parameters:
fieldRef
- The field reference (name of a SearchField).order
- The sort order.- Returns:
- The ContentSearcher itself.
-
withFacets
Set the facets.- Parameters:
facets
- The facets list.- Returns:
- The ContentSearcher itself.
-
withFacets
Set the facets.- Parameters:
facets
- The facets list.- 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
Search the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query object to execute.- Returns:
- The search results as
AmetysObject
s. - Throws:
Exception
- if an error occurs.
-
search
Search the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query string to execute.- Returns:
- The search results as
AmetysObject
s. - Throws:
Exception
- if an error occurs.
-
searchWithFacets
Search the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query objet to execute.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
searchWithFacets
Search the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query string to execute.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(Query query, Map<String, List<String>> facetValues) throws ExceptionSearch the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query object to execute.facetValues
- The facet values.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
searchWithFacets
public <C extends Content> SearchResults<C> searchWithFacets(String query, Map<String, List<String>> facetValues) throws ExceptionSearch the contents.- Type Parameters:
C
- The type Content- Parameters:
query
- The query string to execute.facetValues
- The facet values.- Returns:
- The search results.
- Throws:
Exception
- if an error occurs.
-
getSort
Get the sort criteria from the specified field names.- Returns:
- The sort criteria.
-
getFacets
Get the facet criteria as a list of SearchField from the specified field names.- Returns:
- The facets as a List of SearchField.
-