fix tag matching for elems with __any__ and exact matches

this allows you to have a table with mapping foo=__any__ and another
one with foo=bar and an element with foo=bar will be inserted in
both tables
master
Oliver Tonnhofer 2014-01-22 11:35:53 +01:00
parent d41b108959
commit 07897d5402
2 changed files with 8 additions and 3 deletions

View File

@ -318,6 +318,12 @@ func TestPolygonMatcher(t *testing.T) {
tags = element.Tags{"building": "residential"}
matchesEqual(t, []Match{{"building", "residential", DestTable{"buildings", ""}, nil}}, polys.Match(&tags))
tags = element.Tags{"building": "shop"}
matchesEqual(t, []Match{
{"building", "shop", DestTable{"buildings", ""}, nil},
{"building", "shop", DestTable{"amenity_areas", ""}, nil}},
polys.Match(&tags))
tags = element.Tags{"landuse": "farm"}
matchesEqual(t, []Match{{"landuse", "farm", DestTable{"landusages", ""}, nil}}, polys.Match(&tags))

View File

@ -52,12 +52,11 @@ func (tagMatcher *TagMatcher) Match(tags *element.Tags) []Match {
for _, t := range tbls {
tables[t] = Match{k, v, t, tagMatcher.tables[t.Name]}
}
continue
} else if tbls, ok := values[v]; ok {
}
if tbls, ok := values[v]; ok {
for _, t := range tbls {
tables[t] = Match{k, v, t, tagMatcher.tables[t.Name]}
}
continue
}
}
}