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.
|
FieldSortContext |
byRawField(String absoluteFieldPath)
Order elements by the value of a specific raw field.
|
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.FieldSortContext byRawField(String absoluteFieldPath)
The default order is ascending.
Using this method instead of byField(String) will disable some of the conversion applied to
arguments to FieldSortMissingValueContext.use(Object),
allowing to pass values directly to the backend.
This is useful when the type of the indexed property is not the same as the type of search parameters.
For example one may use a custom bridge implementing ValueBridge<MyType, String>
to translate a property from a custom type to a string when indexing.
When targeting that field with byField,
Hibernate Search will expect arguments to FieldSortMissingValueContext.use(Object) to be instances of the custom type;
with byRawField, it will expect strings.
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.byField(String)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-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.