public class DelegatingSearchSortContainerContext extends Object implements SearchSortContainerContext
SearchSortContainerContext
.
Mainly useful when implementing a SearchSortContainerContextExtension
.
Constructor and Description |
---|
DelegatingSearchSortContainerContext(SearchSortContainerContext delegate) |
Modifier and Type | Method and Description |
---|---|
NonEmptySortContext |
by(SearchSort sort)
Order by the given sort.
|
DistanceSortContext |
byDistance(String absoluteFieldPath,
double latitude,
double longitude)
Order elements by the distance from the location stored in the specified field to the location specified.
|
DistanceSortContext |
byDistance(String absoluteFieldPath,
GeoPoint location)
Order elements by the distance from the location stored in the specified field to the location specified.
|
FieldSortContext |
byField(String absoluteFieldPath)
Order elements by the value of a specific field.
|
NonEmptySortContext |
byIndexOrder()
Order elements by their internal index order.
|
ScoreSortContext |
byScore()
Order elements by their relevance score.
|
SearchSortContainerExtensionContext |
extension()
Create a context allowing to try to apply multiple extensions one after the other,
failing only if none of the extensions is supported.
|
<T> T |
extension(SearchSortContainerContextExtension<T> extension)
Extend the current context with the given extension,
resulting in an extended context offering different types of sorts.
|
protected SearchSortContainerContext |
getDelegate() |
public DelegatingSearchSortContainerContext(SearchSortContainerContext delegate)
public ScoreSortContext byScore()
SearchSortContainerContext
The default order is descending, i.e. higher scores come first.
byScore
in interface SearchSortContainerContext
chain other sorts
or get the resulting sort
.public NonEmptySortContext byIndexOrder()
SearchSortContainerContext
byIndexOrder
in interface SearchSortContainerContext
chain other sorts
or get the resulting sort
.public FieldSortContext byField(String absoluteFieldPath)
SearchSortContainerContext
The default order is ascending.
byField
in interface SearchSortContainerContext
absoluteFieldPath
- The absolute path of the index field to sort bychain other sorts
or get the resulting sort
.public DistanceSortContext byDistance(String absoluteFieldPath, GeoPoint location)
SearchSortContainerContext
The default order is ascending.
byDistance
in interface SearchSortContainerContext
absoluteFieldPath
- The absolute path of the indexed location field to sort by.location
- The location to which we want to compute the distance.chain other sorts
or get the resulting sort
.public DistanceSortContext byDistance(String absoluteFieldPath, double latitude, double longitude)
SearchSortContainerContext
The default order is ascending.
byDistance
in interface SearchSortContainerContext
absoluteFieldPath
- The absolute path of the indexed location field to sort by.latitude
- The latitude of the location to which we want to compute the distance.longitude
- The longitude of the location to which we want to compute the distance.chain other sorts
or get the resulting sort
.public NonEmptySortContext by(SearchSort sort)
SearchSortContainerContext
by
in interface SearchSortContainerContext
sort
- A previously-built SearchSort
object.chain other sorts
or get the resulting sort
.public <T> T extension(SearchSortContainerContextExtension<T> extension)
SearchSortContainerContext
extension
in interface SearchSortContainerContext
T
- The type of context provided by the extension.extension
- The extension to the sort DSL.public SearchSortContainerExtensionContext extension()
SearchSortContainerContext
If you only need to apply a single extension and fail if it is not supported,
use the simpler SearchSortContainerContext.extension(SearchSortContainerContextExtension)
method instead.
extension
in interface SearchSortContainerContext
protected SearchSortContainerContext getDelegate()
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.