X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/c91b86a1d1271c2bc801ee9dfc3a30fb2758aa9b..77d2fcf9dd80a57e2748ff4a57fb1d603562b9e9:/app/controllers/search_controller.rb diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index f88340fb6..fc45f315a 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -3,7 +3,6 @@ class SearchController < ApplicationController # Can search by tag k, v, or both (type->k,value->v) # Can search by name (k=name,v=....) - before_filter :authorize after_filter :compress_output def search_all @@ -22,8 +21,6 @@ class SearchController < ApplicationController def do_search(do_ways,do_segments,do_nodes) - response.headers["Content-Type"] = 'text/xml' - type = params['type'] value = params['value'] unless type or value @@ -95,21 +92,20 @@ class SearchController < ApplicationController # Fetch any segments needed for our ways (only have matching segments so far) seg_ids = Array.new ways.each do |way| - seg_ids += way.segments + seg_ids += way.segs end segments += Segment.find(seg_ids) # Fetch any nodes needed for our segments (only have matching nodes so far) node_ids = Array.new segments.each do |seg| - node_ids += seg.node_a - node_ids += seg.node_b + node_ids += [seg.node_a, seg.node_b] end nodes += Node.find(node_ids) # Print - doc = OSM::API.get_xml_doc + doc = OSM::API.new.get_xml_doc nodes.each do |node| doc.root << node.to_xml_node() end @@ -122,6 +118,6 @@ class SearchController < ApplicationController doc.root << way.to_xml_node() end - render :text => doc.to_s + render :text => doc.to_s, :content_type => "text/xml" end end