improve distance facets example

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1570645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-02-21 17:57:41 +00:00
parent 38b30d4fcb
commit 7ec6bd843b
1 changed files with 2 additions and 1 deletions

View File

@ -51,6 +51,7 @@ import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.SloppyMath;
@ -146,7 +147,7 @@ public class DistanceFacetsExample implements Closeable {
double originLatRadians = Math.toRadians(originLat);
double originLngRadians = Math.toRadians(originLng);
double angle = maxDistanceKM / EARTH_RADIUS_KM;
double angle = maxDistanceKM / (SloppyMath.earthDiameter(originLat) / 2.0);
double minLat = originLatRadians - angle;
double maxLat = originLatRadians + angle;