- remove the events/outages module, ArcGIS adapter, portal config and event statuses - add a configurable city dictionary/parser and make City part of StreetKey - seed: read city/city_name, namespace IDs by city, keep structures distinct - fix reliability: schema v2 with fail-closed load, deterministic ordering, input limits, config validation, atomic DB publish, LLM response caps - add read-only shadow mode comparing the old ES path with addrkit - breaking: registry.db must be re-seeded; config has no portal section
24 lines
910 B
Go
24 lines
910 B
Go
package address
|
|
|
|
import "strings"
|
|
|
|
// streetKey builds the canonical, city-aware, type-independent street key:
|
|
//
|
|
// "<cityKey>|<ordinal>|<sorted name tokens>"
|
|
//
|
|
// The city is part of the key so that "Ленина" in Novosibirsk and "Ленина" in
|
|
// Berdsk are different streets. The type word is dropped so that a user who
|
|
// omits it ("станционная 1" instead of "Станционная улица 1") still matches;
|
|
// type confusion is surfaced later as ambiguity.
|
|
//
|
|
// None of the components may contain "|": NormalizeText folds all punctuation
|
|
// that could appear in a name into spaces, and ordinals are digits only.
|
|
func streetKey(cityKey, ordinal, nameKey string) string {
|
|
return cityKey + "|" + ordinal + "|" + nameKey
|
|
}
|
|
|
|
// normalizeOrdinal trims leading zeros so "02-я" and "2-я" agree.
|
|
func normalizeOrdinal(s string) string {
|
|
return trimLeadingZeros(strings.TrimSpace(s))
|
|
}
|