From 8dd4a6473ef2a0e124161556ef28eb8c98fd434e Mon Sep 17 00:00:00 2001 From: Nicholas Knize Date: Fri, 8 Jul 2016 12:13:22 -0500 Subject: [PATCH] Remove radial restriction for GeoDistanceQuery As of lucene 6.1 GeoDistanceQuery no longer requires restricting the radial distance in GeoPointDistanceQuery. closes #17578 --- .../elasticsearch/index/query/GeoDistanceQueryBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java index 710cb529c07..2f800e9d61a 100644 --- a/core/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/GeoDistanceQueryBuilder.java @@ -314,7 +314,10 @@ public class GeoDistanceQueryBuilder extends AbstractQueryBuilder use prefix encoded postings format final GeoPointField.TermEncoding encoding = (indexVersionCreated.before(Version.V_2_3_0)) ? GeoPointField.TermEncoding.NUMERIC : GeoPointField.TermEncoding.PREFIX; - normDistance = GeoUtils.maxRadialDistance(center, normDistance); + // Lucene 6.0 and earlier requires a radial restriction + if (indexVersionCreated.before(Version.V_5_0_0_alpha4)) { + normDistance = GeoUtils.maxRadialDistance(center, normDistance); + } return new GeoPointDistanceQuery(fieldType.name(), encoding, center.lat(), center.lon(), normDistance); }