From 07897d5402aa10040dae0b43016e210fb6cc2733 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Wed, 22 Jan 2014 11:35:53 +0100 Subject: [PATCH] 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 --- mapping/filter_test.go | 6 ++++++ mapping/matcher.go | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mapping/filter_test.go b/mapping/filter_test.go index e3a8ef8..5f3a573 100644 --- a/mapping/filter_test.go +++ b/mapping/filter_test.go @@ -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)) diff --git a/mapping/matcher.go b/mapping/matcher.go index 424f9b9..9339e3e 100644 --- a/mapping/matcher.go +++ b/mapping/matcher.go @@ -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 } } }