From e675073ab2f5f3c47515212c71297f85c68feac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Karas?= Date: Fri, 8 Dec 2023 00:03:31 +0100 Subject: [PATCH] add region name to location tokens Locations are streets in town usually. But for small villages without named streets, village name (region) is added as virtual location to our location index. Address points are linked by "addr:place" tag to the place (region). So, to be able lookup address points just by phrase "Village 123", we add region name to location search patterns. `We would force users to use pattern "Village Village 123" otherwise. --- .../src/osmscout/location/LocationService.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libosmscout/src/osmscout/location/LocationService.cpp b/libosmscout/src/osmscout/location/LocationService.cpp index 0016bc366..5431de31a 100644 --- a/libosmscout/src/osmscout/location/LocationService.cpp +++ b/libosmscout/src/osmscout/location/LocationService.cpp @@ -1379,9 +1379,19 @@ namespace osmscout { locationIgnoreTokenSet.insert(UTF8StringToUpper(token)); } + // Locations are streets in town usually. But for small villages without named streets, + // village name (region) is added as virtual location to our location index. + // Address points are linked by "addr:place" tag to the place (region). + // + // So, to be able lookup address points just by phrase "Village 123", + // we add region name to location search patterns. + // We would force users to use pattern "Village Village 123" otherwise. + std::list extendedLocationTokens=locationTokens; + extendedLocationTokens.push_back(regionMatch.name); + // Build Location search patterns - std::list locationSearchPatterns=GenerateSearchPatterns(locationTokens, + std::list locationSearchPatterns=GenerateSearchPatterns(extendedLocationTokens, locationIgnoreTokenSet, locationIndex->GetLocationMaxWords());