aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-05-27 11:16:04 +0000
committerfrancis <francis>2008-05-27 11:16:04 +0000
commitfd9c5f14863e7aa02d31e22f9bb11484bb595966 (patch)
treefb86a1efc528bd59b41b99e9c8419846b4b73f39
parentbc2267d366f627ab7208273b2ece2af1b847c086 (diff)
Make search tracks work for queries with dots and slashes.
-rw-r--r--app/controllers/track_controller.rb8
-rw-r--r--config/routes.rb5
-rw-r--r--todo.txt2
3 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 6bdd8960f..b010a5798 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -5,7 +5,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_controller.rb,v 1.21 2008-05-21 14:51:34 francis Exp $
+# $Id: track_controller.rb,v 1.22 2008-05-27 11:16:05 francis Exp $
class TrackController < ApplicationController
@@ -97,7 +97,11 @@ class TrackController < ApplicationController
# Track a search term
def track_search_query
- @query = params[:query]
+ # XXX should be better thing in rails routes than having to do this
+ # join just to get / and . to work in a query.
+ query_array = params[:query_array]
+ @query = query_array.join("/")
+
@track_thing = TrackThing.create_track_for_search_query(@query)
ret = self.track_set
if ret
diff --git a/config/routes.rb b/config/routes.rb
index b72bf488a..90825ac50 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: routes.rb,v 1.64 2008-05-18 21:53:16 francis Exp $
+# $Id: routes.rb,v 1.65 2008-05-27 11:16:05 francis Exp $
ActionController::Routing::Routes.draw do |map|
@@ -66,7 +66,8 @@ ActionController::Routing::Routes.draw do |map|
track.track_list '/track/list/:view', :action => 'track_list', :view => nil
track.track_public_body "/track/body/:url_name", :action => 'track_public_body'
track.track_user "/track/user/:url_name", :action => 'track_user'
- track.track_search "/track/search/:query", :action => 'track_search_query'
+ # XXX must be better way of getting dots and slashes in search queries to work than this *query_array
+ track.track_search "/track/search/*query_array", :action => 'track_search_query'
track.update '/track/update/:track_id', :action => 'update'
track.atom_feed '/track/feed/:track_id', :action => 'atom_feed'
diff --git a/todo.txt b/todo.txt
index 06de77bbb..7469de6c7 100644
--- a/todo.txt
+++ b/todo.txt
@@ -32,8 +32,6 @@ BAILII - relationship with law courts, robots.txt ?
Next
====
-Detect postcodes
-
Blog posts / Wikipedia articles about this request
e.g. http://socialreporter.wordpress.com/2008/04/14/costs-of-the-bbc-action-action-network/
http://reportr.net/2008/04/24/bbc-spent-6m-to-develop-the-iplayer/