You can use LatLonPoint.newDistanceQuery to get the results within the specified distance, and then use LatLonDocValuesField.newDistanceSort to sort by distance, and use the IndexSearcher.search method that takes Sort. Then the results should be all points within the radius, sorted by distance. That should (maybe) be faster than computing haversin yourself on all hits.
Extending LatLonPoint.nearest to take a distance instead of top N should be possible ... maybe open an issue? Mike McCandless http://blog.mikemccandless.com On Thu, Jun 29, 2017 at 1:41 PM, sc <scattaman...@4info.com> wrote: > Thank you so much. With LatLonPoint.nearest(..), I am getting results in > 6ms, > with accurate results, when I compared MongoDB.geoNear(). > > I also tried with LatLonPoint.newDistanceQuery, and I got results in 6ms > but the results are NOT the nearest points. > > Few more questions: > > Is there an API that use with LatLonPoint.nearest where I can specify the > radius. > > Or how can I sort results from LatLonPoint.newDistanceQuery? > > Thanks again. > > > > > > -- > View this message in context: http://lucene.472066.n3.nabble > .com/Lucene-GeoNear-Search-and-Sort-Performance-tp4343468p4343502.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >