public class ContentSearcherFactory.SimpleContentSearcher extends Object
Modifier and Type | Field and Description |
---|---|
private boolean |
_checkRights |
private Set<String> |
_contentTypes |
private List<String> |
_facets |
private int |
_maxResults |
private List<Sort> |
_sort |
private int |
_start |
Constructor and Description |
---|
SimpleContentSearcher(Collection<String> contentTypes)
Build a content searcher on a list of content types.
|
Modifier and Type | Method and Description |
---|---|
private SearcherFactory.Searcher |
_searcher(Query query,
Map<String,List<String>> facetValues) |
ContentSearcherFactory.SimpleContentSearcher |
addSort(String fieldRef,
Sort.Order order)
Add a sort criterion.
|
protected List<SearchField> |
getFacets()
Get the facet criteria as a list of SearchField from the specified field names.
|
protected List<Sort> |
getSort()
Get the sort criteria from the specified field names.
|
<C extends Content> |
search(Query query)
Search the contents.
|
<C extends Content> |
searchWithFacets(Query query)
Search the contents.
|
<C extends Content> |
searchWithFacets(Query query,
Map<String,List<String>> facetValues)
Search the contents.
|
ContentSearcherFactory.SimpleContentSearcher |
setCheckRights(boolean checkRights)
Whether to check rights when searching, false otherwise.
|
ContentSearcherFactory.SimpleContentSearcher |
withFacets(List<String> facets)
Set the facets.
|
ContentSearcherFactory.SimpleContentSearcher |
withFacets(String... facets)
Set the facets.
|
ContentSearcherFactory.SimpleContentSearcher |
withLimits(int start,
int maxResults)
Set the limits to use.
|
ContentSearcherFactory.SimpleContentSearcher |
withSort(List<Sort> sortCriteria)
Set the sort criteria.
|
private Set<String> _contentTypes
private int _start
private int _maxResults
private boolean _checkRights
public SimpleContentSearcher(Collection<String> contentTypes)
contentTypes
- A collection of content types to search on.public ContentSearcherFactory.SimpleContentSearcher withSort(List<Sort> sortCriteria)
sortCriteria
- The sort criteria as a List.public ContentSearcherFactory.SimpleContentSearcher addSort(String fieldRef, Sort.Order order)
fieldRef
- The field reference (name of a SearchField).order
- The sort order.public ContentSearcherFactory.SimpleContentSearcher withFacets(List<String> facets)
facets
- The facets list.public ContentSearcherFactory.SimpleContentSearcher withFacets(String... facets)
facets
- The facets list.public ContentSearcherFactory.SimpleContentSearcher withLimits(int start, int maxResults)
start
- The start index.maxResults
- The maximum number of results.public ContentSearcherFactory.SimpleContentSearcher setCheckRights(boolean checkRights)
checkRights
- true
to check rights, false
otherwise.public <C extends Content> AmetysObjectIterable<C> search(Query query) throws Exception
C
- The type Contentquery
- The query to execute.AmetysObject
s.Exception
- if an error occurs.public <C extends Content> SearchResults<C> searchWithFacets(Query query) throws Exception
C
- The type Contentquery
- The query to execute.Exception
- if an error occurs.public <C extends Content> SearchResults<C> searchWithFacets(Query query, Map<String,List<String>> facetValues) throws Exception
C
- The type Contentquery
- The query to execute.facetValues
- The facet values.Exception
- if an error occurs.private SearcherFactory.Searcher _searcher(Query query, Map<String,List<String>> facetValues)
protected List<Sort> getSort()
protected List<SearchField> getFacets()