Remove radial restriction for GeoDistanceQuery

As of lucene 6.1 GeoDistanceQuery no longer requires restricting the radial distance in GeoPointDistanceQuery.

closes #17578
This commit is contained in:
Nicholas Knize 2016-07-08 12:13:22 -05:00
parent 7dff8fbb1d
commit 8dd4a6473e
1 changed files with 4 additions and 1 deletions

View File

@ -314,7 +314,10 @@ public class GeoDistanceQueryBuilder extends AbstractQueryBuilder<GeoDistanceQue
// if index created V_2_3 > use prefix encoded postings format // if index created V_2_3 > use prefix encoded postings format
final GeoPointField.TermEncoding encoding = (indexVersionCreated.before(Version.V_2_3_0)) ? final GeoPointField.TermEncoding encoding = (indexVersionCreated.before(Version.V_2_3_0)) ?
GeoPointField.TermEncoding.NUMERIC : GeoPointField.TermEncoding.PREFIX; GeoPointField.TermEncoding.NUMERIC : GeoPointField.TermEncoding.PREFIX;
// Lucene 6.0 and earlier requires a radial restriction
if (indexVersionCreated.before(Version.V_5_0_0_alpha4)) {
normDistance = GeoUtils.maxRadialDistance(center, normDistance); normDistance = GeoUtils.maxRadialDistance(center, normDistance);
}
return new GeoPointDistanceQuery(fieldType.name(), encoding, center.lat(), center.lon(), normDistance); return new GeoPointDistanceQuery(fieldType.name(), encoding, center.lat(), center.lon(), normDistance);
} }