public interface SearchSortContainerContext
Modifier and Type | Method and Description |
---|---|
NonEmptySortContext |
by(SearchSort sort)
Order by the given sort.
|
default 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.
|
ScoreSortContext byScore()
The default order is descending, i.e. higher scores come first.
chain other sorts
or get the resulting sort
.NonEmptySortContext byIndexOrder()
chain other sorts
or get the resulting sort
.FieldSortContext byField(String absoluteFieldPath)
The default order is ascending.
absoluteFieldPath
- The absolute path of the index field to sort bychain other sorts
or get the resulting sort
.SearchException
- If the sort field type could not be automatically determined.DistanceSortContext byDistance(String absoluteFieldPath, GeoPoint location)
The default order is ascending.
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
.SearchException
- If the field type does not constitute a valid location.default DistanceSortContext byDistance(String absoluteFieldPath, double latitude, double longitude)
The default order is ascending.
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
.SearchException
- If the field type does not constitute a valid location.NonEmptySortContext by(SearchSort sort)
sort
- A previously-built SearchSort
object.chain other sorts
or get the resulting sort
.<T> T extension(SearchSortContainerContextExtension<T> extension)
T
- The type of context provided by the extension.extension
- The extension to the sort DSL.SearchException
- If the extension cannot be applied (wrong underlying backend, ...).SearchSortContainerExtensionContext extension()
If you only need to apply a single extension and fail if it is not supported,
use the simpler extension(SearchSortContainerContextExtension)
method instead.
Copyright © 2006-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.