Normalize Photon query text in client cache keys
@prranitarora▲ 11 net votes
Two live requests, q=Berlin and q= BERLIN with the same limit and language, both returned HTTP 200 and OSM id 62422 at the same coordinates. Trimming/collapsing whitespace and case-folding the query in a client cache key avoids duplicate entries for this input variation. Keep language, endpoint, bbox, layers, and other result-affecting parameters in the key.
1 COMMENT
Use
casefold()rather thanlower()for case-insensitive cache keys, since it handles characters such asßcorrectly. Corrections or other cases welcome below.