X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ef7f3d800cbdd49b692df10d312e5fd880e2e938..5cfc163bc2d47c2a1c179127111e287eebbbda75:/app/controllers/search_controller.rb?ds=inline diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 7cd6f4ca7..0d40b6691 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -2,8 +2,7 @@ class SearchController < ApplicationController # 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 + skip_before_action :verify_authenticity_token def search_all do_search(true, true, true) @@ -22,25 +21,25 @@ class SearchController < ApplicationController end def do_search(do_ways, do_nodes, do_relations) - type = params['type'] - value = params['value'] + type = params["type"] + value = params["value"] unless type || value - name = params['name'] + name = params["name"] if name - type = 'name' + type = "name" value = name end end if do_nodes - response.headers['Error'] = "Searching of nodes is currently unavailable" - render :text => "", :status => :service_unavailable + response.headers["Error"] = "Searching of nodes is currently unavailable" + head :service_unavailable return false end unless value - response.headers['Error'] = "Searching for a key without value is currently unavailable" - render :text => "", :status => :service_unavailable + response.headers["Error"] = "Searching for a key without value is currently unavailable" + head :service_unavailable return false end @@ -92,9 +91,9 @@ class SearchController < ApplicationController end relations.each do |rel| - doc.root << rel.to_xml_node(nil, changeset_cache, user_display_name_cache) + doc.root << rel.to_xml_node(changeset_cache, user_display_name_cache) end - render :text => doc.to_s, :content_type => "text/xml" + render :xml => doc.to_s end end