Optimized LatLon sorting does not work in the descending order.
This commit is contained in:
parent
729804cb60
commit
ff245a72c5
|
@ -558,6 +558,7 @@ public class GeoDistanceSortBuilder extends SortBuilder<GeoDistanceSortBuilder>
|
|||
&& nested == null
|
||||
&& finalSortMode == MultiValueMode.MIN // LatLonDocValuesField internally picks the closest point
|
||||
&& unit == DistanceUnit.METERS
|
||||
&& reverse == false
|
||||
&& localPoints.size() == 1) {
|
||||
return new SortFieldAndFormat(
|
||||
LatLonDocValuesField.newDistanceSort(fieldName, localPoints.get(0).lat(), localPoints.get(0).lon()),
|
||||
|
|
|
@ -501,5 +501,10 @@ public class GeoDistanceSortBuilderTests extends AbstractSortTestCase<GeoDistanc
|
|||
builder.setNestedPath("some_nested_path");
|
||||
sort = builder.build(context);
|
||||
assertEquals(SortField.class, sort.field.getClass()); // can't use LatLon optimized sorting with nested fields
|
||||
|
||||
builder = new GeoDistanceSortBuilder("random_field_name", new GeoPoint(3.5, 2.1));
|
||||
builder.order(SortOrder.DESC);
|
||||
sort = builder.build(context);
|
||||
assertEquals(SortField.class, sort.field.getClass()); // can't use LatLon optimized sorting with DESC sorting
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue