org.hibernate.search.query.dsl.sort.impl

## Class ConnectedSortContext

- java.lang.Object
- - org.hibernate.search.query.dsl.sort.impl.AbstractConnectedSortContext
  - - org.hibernate.search.query.dsl.sort.impl.ConnectedSortContext

- All Implemented Interfaces:
    SortContext

      public class ConnectedSortContext
      extends AbstractConnectedSortContext
      implements SortContext

  Author:
    Emmanuel Bernard emmanuel@hibernate.org

- - ### Field Summary

    - ### Fields inherited from class org.hibernate.search.query.dsl.sort.impl.AbstractConnectedSortContext

      `queryContext, states`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConnectedSortContext(QueryBuildingContext queryContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SortDistanceNoFieldContext` | `byDistance()` Order elements by distance.
    `SortFieldContext` | `byField(String field)` Order elements by the value of a specific field.
    `SortFieldContext` | `byField(String field, SortField.Type sortFieldType)` Order elements by value of a specific field, with the sort field type provided.
    `SortOrderTermination` | `byIndexOrder()` Order elements by their internal index order.
    `SortNativeContext` | `byNative(SortField sortField)` Order element using the native backend API for Lucene.
    `SortNativeContext` | `byNative(String field, String nativeDescription)` Order element using the native backend API for Elasticsearch.
    `SortScoreContext` | `byScore()` Order elements by their relevance score.

    - ### Methods inherited from class org.hibernate.search.query.dsl.sort.impl.AbstractConnectedSortContext

      `getQueryContext, getStates`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConnectedSortContext

          public ConnectedSortContext(QueryBuildingContext queryContext)

  - ### Method Detail

    - #### byScore

          public SortScoreContext byScore()

      Description copied from interface: `SortContext`
      Order elements by their relevance score.

      The default order is descending, i.e. higher scores come first.

      Specified by:
        `byScore` in interface `SortContext`

    - #### byIndexOrder

          public SortOrderTermination byIndexOrder()

      Description copied from interface: `SortContext`
      Order elements by their internal index order.
      Specified by:
        `byIndexOrder` in interface `SortContext`

    - #### byField

          public SortFieldContext byField(String field)

      Description copied from interface: `SortContext`
      Order elements by the value of a specific field.

      The default order is ascending.

      The sort field type will be determined automatically if possible, and an exception will be thrown if it is not possible. Automatically determining the type is impossible in particular if a custom field bridge is defined on the given field and if this bridge doesn't implement `MetadataProvidingFieldBridge`.

      Specified by:
        `byField` in interface `SortContext`
      Parameters:
        `field` - The name of the index field to sort by
      See Also:
        `The alternative for numeric fields with custom field bridges that don't implement {@link MetadataProvidingFieldBridge}.`

    - #### byField

          public SortFieldContext byField(String field,
                                          SortField.Type sortFieldType)

      Description copied from interface: `SortContext`
      Order elements by value of a specific field, with the sort field type provided.

      The default order is ascending.

      Note: using this method is only required when sorting on a field on which a custom field bridge that doesn't implement `MetadataProvidingFieldBridge` is defined. Otherwise, one may simply use `SortContext.byField(String)`.

      Specified by:
        `byField` in interface `SortContext`
      Parameters:
        `field` - The name of the index field to sort by
        `sortFieldType` - The sort field type

    - #### byDistance

          public SortDistanceNoFieldContext byDistance()

      Description copied from interface: `SortContext`
      Order elements by distance.

      The default order is ascending, i.e. shorter distances come first.

      The distance is computed between the value of a field carrying coordinates (to be provided in the `next context`) and reference coordinates.

      Specified by:
        `byDistance` in interface `SortContext`

    - #### byNative

          public SortNativeContext byNative(SortField sortField)

      Description copied from interface: `SortContext`
      Order element using the native backend API for Lucene.

      The sort order (ascending/descending) is defined in `sortField`

      Specified by:
        `byNative` in interface `SortContext`
      Parameters:
        `sortField` - The sort field to be added to the sort list.

    - #### byNative

          public SortNativeContext byNative(String field,
                                            String nativeDescription)

      Description copied from interface: `SortContext`
      Order element using the native backend API for Elasticsearch.
      Specified by:
        `byNative` in interface `SortContext`
      Parameters:
        `field` - The name of the index field to sort by
        `nativeDescription` - The sort field description, as valid JSON. This may be a simple quoted string (e.g. "'asc'") or a JSON map (e.g. "{'key': 'value'}"). See Elasticsearch's documentation for information about the exact syntax.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved