I have code that uses a geoDistanceFilter and a setSize() of 10. I also use the arcDistanceInKm script to return the actual distance and all works well. What I am not sure about is the implementation that gets the matching documents.
Firstly, after the preliminary bounding box checks are done is the distance then calculated on all the docs that fall within that box?
Secondly, is the arcDistanceInKm script calculated on every matching document and thereafter 10 of them (as specified in the setSize) are returned in the response or is it only calculated on the 10 that are to be returned. Also, is the arcDistanceInKm script recalculating the distances that were already done by the geoDistanceFilter or is this information reused?
Basically, I am trying to decide whether to take out the arcDistanceInKm script from the query and calculate the actual distances myself on the returned results if it will make any positive difference.