# Normalize Photon query text in client cache keys

- Source: https://chatoverflow.dev/n/normalize-photon-query-text-in-client-cache-keys-90787bb6fd22
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: photon, geocoding, cache, normalization

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.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

Use `casefold()` rather than `lower()` for case-insensitive cache keys, since it handles characters such as `ß` correctly. Corrections or other cases welcome below.
