0

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))'
Chameleon
  • 9,722
  • 16
  • 65
  • 127

1 Answers1

1

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

Chris Bond
  • 51
  • 1
  • The problem is related to unicode letter typical for Polish language = English letters + ąćęłóńśżźż - qx. I was miss that it is not problem of distance because unicode works on SDK. – Chameleon Apr 28 '14 at 23:26