+ relations = Array.new
+
+ # Matching for tags table
+ cond_way = Array.new
+ sql = '1=1'
+ if type
+ sql += ' AND current_way_tags.k=?'
+ cond_way += [type]
+ end
+ if value
+ sql += ' AND current_way_tags.v=? AND MATCH (current_way_tags.v) AGAINST (? IN BOOLEAN MODE)'
+ cond_way += [value,'"' + value.sub(/[-+*<>"~()]/, ' ') + '"']
+ end
+ cond_way = [sql] + cond_way