Reputation: 10138
I have such SortExpression:
from google.appengine.api.search import search
search.SortExpression(expression = 'distance(geoLocation, geopoint(%s, %s))'
% (geoLatitude, geoLongitude),
direction = search.SortExpression.ASCENDING,
default_value = sys.float_info.max)
What should be default_value
for distance()
?
Currently sys.float_info.max
works on SDK but generates errors on production:
InvalidRequest: Failed to parse search request "tag:"zamówienia internetowe" AND tag:"zamówienia na teraz""; Default text value is not appropriate for sort expression 'distance(geoLocation, geopoint(52.1967225, 20.8892005))'
Upvotes: 0
Views: 269
Reputation: 51
If you want the default to be last in the results, I'd suggest picking a value that's larger than half the circumference of the Earth at its widest point (i.e., the equator). I believe that any value greater than 20,038,000 meters should be larger than any possible distance, even accounting for future refinements in how we model the Earth in production.
Chris
Upvotes: 1