public abstract class AbstractSearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,PDC extends SearchPredicateFactoryContext,SC extends SearchSortContainerContext,C> extends Object implements SearchQueryResultContext<S,H,PDC>, SearchQueryContext<S,H,SC>
| Constructor and Description |
|---|
AbstractSearchQueryContext(IndexSearchScope<C> indexSearchScope,
SearchQueryBuilder<H,C> searchQueryBuilder) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract PDC |
extendPredicateContext(SearchPredicateFactoryContext predicateFactoryContext) |
protected abstract SC |
extendSortContext(SearchSortContainerContext sortContainerContext) |
SearchResult<H> |
fetch()
Execute the query and return the
SearchResult. |
SearchResult<H> |
fetch(Integer limit)
Execute the query and return the
SearchResult. |
SearchResult<H> |
fetch(Integer limit,
Integer offset)
Execute the query and return the
SearchResult. |
List<H> |
fetchHits()
Execute the query and return the hits as a
List. |
List<H> |
fetchHits(Integer limit)
Execute the query and return the hits as a
List. |
List<H> |
fetchHits(Integer limit,
Integer offset)
Execute the query and return the hits as a
List. |
Optional<H> |
fetchSingleHit()
Execute the query and return the hits as a single, optional element.
|
long |
fetchTotalHitCount()
Execute the query and return the total hit count.
|
S |
predicate(Function<? super PDC,SearchPredicateTerminalContext> predicateContributor)
Set the predicate for this query.
|
S |
predicate(SearchPredicate predicate)
Set the predicate for this query.
|
S |
routing(Collection<String> routingKeys) |
S |
routing(String routingKey) |
S |
sort(Consumer<? super SC> sortContributor) |
S |
sort(SearchSort sort) |
protected abstract S |
thisAsS() |
SearchQuery<H> |
toQuery() |
public AbstractSearchQueryContext(IndexSearchScope<C> indexSearchScope, SearchQueryBuilder<H,C> searchQueryBuilder)
public S predicate(SearchPredicate predicate)
SearchQueryResultContextpredicate in interface SearchQueryResultContext<S extends SearchQueryContext<S,H,SC>,H,PDC extends SearchPredicateFactoryContext>predicate - A SearchPredicate object obtained from the search scope.public S predicate(Function<? super PDC,SearchPredicateTerminalContext> predicateContributor)
SearchQueryResultContextpredicate in interface SearchQueryResultContext<S extends SearchQueryContext<S,H,SC>,H,PDC extends SearchPredicateFactoryContext>predicateContributor - A function that will use the DSL context passed in parameter to create a predicate,
returning the resulting terminal context.
Should generally be a lambda expression.public S routing(String routingKey)
routing in interface SearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,SC extends SearchSortContainerContext>public S routing(Collection<String> routingKeys)
routing in interface SearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,SC extends SearchSortContainerContext>public S sort(SearchSort sort)
sort in interface SearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,SC extends SearchSortContainerContext>public S sort(Consumer<? super SC> sortContributor)
sort in interface SearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,SC extends SearchSortContainerContext>public SearchQuery<H> toQuery()
toQuery in interface SearchQueryContext<S extends SearchQueryContext<S,H,SC>,H,SC extends SearchSortContainerContext>public SearchResult<H> fetch()
SearchFetchableSearchResult.fetch in interface SearchFetchable<H>SearchResult.public SearchResult<H> fetch(Integer limit)
SearchFetchableSearchResult.fetch in interface SearchFetchable<H>limit - The maximum number of hits to be included in the SearchResult. null means no limit.SearchResult.public SearchResult<H> fetch(Integer limit, Integer offset)
SearchFetchableSearchResult.fetch in interface SearchFetchable<H>limit - The maximum number of hits to be included in the SearchResult. null means no limit.offset - The number of hits to skip before adding the hits to the SearchResult. null means no offset.SearchResult.public List<H> fetchHits()
SearchFetchableList.fetchHits in interface SearchFetchable<H>public List<H> fetchHits(Integer limit)
SearchFetchableList.fetchHits in interface SearchFetchable<H>limit - The maximum number of hits to be returned by this method. null means no limit.public List<H> fetchHits(Integer limit, Integer offset)
SearchFetchableList.fetchHits in interface SearchFetchable<H>limit - The maximum number of hits to be returned by this method. null means no limit.offset - The number of hits to skip. null means no offset.public Optional<H> fetchSingleHit()
SearchFetchablefetchSingleHit in interface SearchFetchable<H>public long fetchTotalHitCount()
SearchFetchablefetchTotalHitCount in interface SearchFetchable<H>protected abstract S thisAsS()
protected abstract PDC extendPredicateContext(SearchPredicateFactoryContext predicateFactoryContext)
protected abstract SC extendSortContext(SearchSortContainerContext sortContainerContext)
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.