S - The "self" type (the actual exposed type of this step).
May be a subtype of SearchQueryOptionsStep with more exposed methods.H - The type of hits for the created query.SF - The type of factory used to create sorts in sort(Function).AF - The type of factory used to create aggregations in aggregation(AggregationKey, Function).public interface SearchQueryOptionsStep<S extends SearchQueryOptionsStep<?,H,SF,AF>,H,SF extends SearchSortFactory,AF extends SearchAggregationFactory> extends SearchQueryFinalStep<H>, SearchFetchable<H>
sorts can be set,
and where the query can be executed or retrieved as an object.| Modifier and Type | Method and Description |
|---|---|
<T> S |
aggregation(AggregationKey<T> key,
Function<? super AF,? extends AggregationFinalStep<T>> aggregationContributor)
Add an aggregation to this query.
|
<T> S |
aggregation(AggregationKey<T> key,
SearchAggregation<T> aggregation)
Add an aggregation to this query.
|
S |
failAfter(long timeout,
TimeUnit timeUnit)
Stop the query and throw a
SearchTimeoutException after a given timeout. |
S |
routing(Collection<String> routingKeys)
Configure routing of the search query.
|
S |
routing(String routingKey)
Configure routing of the search query.
|
S |
sort(Function<? super SF,? extends SortFinalStep> sortContributor)
Add a sort to this query.
|
S |
sort(SearchSort sort)
Add a sort to this query.
|
S |
truncateAfter(long timeout,
TimeUnit timeUnit)
Stop the query and return truncated results after a given timeout.
|
toQueryfetch, fetch, fetchAll, fetchAllHits, fetchHits, fetchHits, fetchSingleHit, fetchTotalHitCountS routing(String routingKey)
Useful when indexes are sharded, to limit the number of shards interrogated by the search query.
This method may be called multiple times, in which case all submitted routing keys will be taken into account.
By default, if routing is not configured, all shards will be queried.
routingKey - A string key. All shards matching this key will be queried.this, for method chaining.S routing(Collection<String> routingKeys)
Similar to routing(String), but allows passing multiple keys in a single call.
routingKeys - A collection containing zero, one or multiple string keys.this, for method chaining.S truncateAfter(long timeout, TimeUnit timeUnit)
The timeout is handled on a best effort basis: Hibernate Search will *try* to stop the query as soon as possible after the timeout.
timeout - Timeout value.timeUnit - Timeout unit.this, for method chaining.S failAfter(long timeout, TimeUnit timeUnit)
SearchTimeoutException after a given timeout.
The timeout is handled on a best effort basis:
Hibernate Search will *try* to stop the query as soon as possible after the timeout.
However, this method is more likely to trigger an early stop than truncateAfter(long, TimeUnit).
timeout - Timeout value.timeUnit - Timeout unit.this, for method chaining.S sort(SearchSort sort)
sort - A SearchSort object obtained from the search scope.this, for method chaining.S sort(Function<? super SF,? extends SortFinalStep> sortContributor)
sortContributor - A function that will use the factory passed in parameter to create a sort,
returning the final step in the sort DSL.
Should generally be a lambda expression.this, for method chaining.<T> S aggregation(AggregationKey<T> key, SearchAggregation<T> aggregation)
T - The type of aggregation values.key - The key that will be used to retrieve the aggregation
from the SearchResult.aggregation - A SearchAggregation object obtained from the search scope.this, for method chaining.<T> S aggregation(AggregationKey<T> key, Function<? super AF,? extends AggregationFinalStep<T>> aggregationContributor)
T - The type of aggregation values.key - The key that will be used to retrieve the aggregation
from the SearchResult.aggregationContributor - A function that will use the factory passed in parameter to create an aggregation,
returning the final step in the sort DSL.
Should generally be a lambda expression.this, for method chaining.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.