Elasticsearch lets you sort by distance between a point and a coordinate in a document through several methods. SLOPPY_ARC (default), ARC and PLANE. Do you think that is implementable directly via the Lucene Sort/SortField classes like you did DistanceSortField / DistanceComparator. Is that worth it? And what is the current implementation doing?
If I do understand the Elasticsearch doc well, ARC is a mathematically correct spherical distance, SLOPPY_ARC is a "faster" computation method and PLANE is planar distance with local projection around the center of the search. I do think that trying to save some CPU cycle here is overkill and not needed in most cases but I think it is globally doable to have a support for multiple distance computation methods in Hibernate Search. The current implementation is doing accurate spherical computation. I need to grab some time to go deeper into Elasticsearch and Hibernate Search code to compare if you need to. |