Skip to content

Commit

Permalink
add region name to location tokens
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Karry committed Dec 7, 2023
1 parent 5bb61c7 commit e675073
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libosmscout/src/osmscout/location/LocationService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> extendedLocationTokens=locationTokens;
extendedLocationTokens.push_back(regionMatch.name);

// Build Location search patterns

std::list<TokenStringRef> locationSearchPatterns=GenerateSearchPatterns(locationTokens,
std::list<TokenStringRef> locationSearchPatterns=GenerateSearchPatterns(extendedLocationTokens,
locationIgnoreTokenSet,
locationIndex->GetLocationMaxWords());

Expand Down

0 comments on commit e675073

Please sign in to comment.