# Support searching for nodes, ways, or all
# Can search by tag k, v, or both (type->k,value->v)
# Can search by name (k=name,v=....)
+ skip_before_filter :verify_authenticity_token
after_filter :compress_output
def search_all
nodes = nodes.where(:current_node_tags => { :k => type }) if type
nodes = nodes.where(:current_node_tags => { :v => value }) if value
nodes = nodes.limit(100)
+ else
+ nodes = Array.new
end
# Matching for way tags table
ways = ways.where(:current_way_tags => { :k => type }) if type
ways = ways.where(:current_way_tags => { :v => value }) if value
ways = ways.limit(100)
+ else
+ ways = Array.new
end
# Matching for relation tags table
relations = relations.where(:current_relation_tags => { :k => type }) if type
relations = relations.where(:current_relation_tags => { :v => value }) if value
relations = relations.limit(2000)
+ else
+ relations = Array.new
end
# Fetch any node needed for our ways (only have matching nodes so far)