Skip to content

Commit

Permalink
HSEARCH-3863 Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
fax4ever and yrodiere committed Feb 8, 2021
1 parent 91e43e9 commit 19cbad0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Expand Up @@ -716,13 +716,13 @@ SearchException customIndexSettingsErrorOnLoading(String filePath, @Cause Except
SearchException customIndexSettingsJsonSyntaxErrors(String filePath, @Cause Exception cause,
@Param EventContext context);

@Message(id = ID_OFFSET + 134, value = "Missing first on sort with ascending order is not supported.")
@Message(id = ID_OFFSET + 134, value = "Invalid use of 'missing().first()' for an ascending distance sort. Elasticsearch always assumes missing values have a distance of '+Infinity', and this behavior cannot be customized.")
SearchException missingFirstOnAscSortNotSupported(@Param EventContext context);

@Message(id = ID_OFFSET + 135, value = "Missing last on sort with descending order is not supported.")
@Message(id = ID_OFFSET + 135, value = "Invalid use of 'missing().first()' for a descending distance sort. Elasticsearch always assumes missing values have a distance of '+Infinity', and this behavior cannot be customized.")
SearchException missingLastOnDescSortNotSupported(@Param EventContext context);

@Message(id = ID_OFFSET + 136, value = "Missing as on sort is not supported with Elasticsearch backend.")
@Message(id = ID_OFFSET + 136, value = "Invalid use of 'missing().use(...)' for a distance sort. Elasticsearch always assumes missing values have a distance of '+Infinity', and this behavior cannot be customized.")
SearchException missingAsOnSortNotSupported(@Param EventContext context);

}
Expand Up @@ -373,10 +373,12 @@ include::{sourcedir}/org/hibernate/search/documentation/search/sort/SortDslIT.ja
// Search 5 anchors backward compatibility
[[_handling_missing_values]]

In case of <<search-dsl-sort-field, sort by field values>>, the documents that do not have any value for a sort field
will appear in the last position by default.
In case of <<search-dsl-sort-distance, sort by distance to a point>>, the documents that do not have any value for a sort field
will be treated as they were at plus infinite distance from the given point.
By default:

* For <<search-dsl-sort-field,sorts by field values>>, the documents that do not have any value for a sort field
will appear in the last position.
* For <<search-dsl-sort-distance,sorts by distance to a point>>, the documents that do not have any value for a sort field
will be treated as they were at plus infinite distance from the given point.

The behavior for missing values can be controlled explicitly through the `.missing()` option:

Expand All @@ -388,7 +390,7 @@ The behavior for missing values can be controlled explicitly through the `.missi
====
All these options are supported in case of sort by field values or in case of sort by distance to a point
using the Lucene backend.
In case of sort by distance to a point using the Elasticsearch backend, due to the current Elasticsearch APIs,
In case of sort by distance to a point using the Elasticsearch backend, due to limitations of the Elasticsearch APIs,
only the following combinations are supported:
* `.missing().first()` using a descending order.
Expand Down

0 comments on commit 19cbad0

Please sign in to comment.