diff options
-rw-r--r-- | app/controllers/application.rb | 6 | ||||
-rw-r--r-- | app/controllers/general_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/track_controller.rb | 4 | ||||
-rw-r--r-- | app/models/info_request.rb | 10 | ||||
-rw-r--r-- | app/models/track_mailer.rb | 4 | ||||
-rw-r--r-- | todo.txt | 2 |
7 files changed, 17 insertions, 19 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 7275e53a7..d51f6cf1d 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: application.rb,v 1.41 2008-04-30 00:37:50 francis Exp $ +# $Id: application.rb,v 1.42 2008-04-30 00:46:00 francis Exp $ class ApplicationController < ActionController::Base @@ -141,7 +141,7 @@ class ApplicationController < ActionController::Base end # Function for search - def perform_search(query, sortby, per_page = 25, this_page = nil, html_highlight = true) + def perform_search(query, sortby, collapse, per_page = 25, this_page = nil, html_highlight = true) @query = query @sortby = sortby @@ -157,7 +157,7 @@ class ApplicationController < ActionController::Base else @page = this_page end - xapian_object = InfoRequest.full_search(@query, order, ascending, @per_page, @page, true) + xapian_object = InfoRequest.full_search(@query, order, ascending, collapse, @per_page, @page) @search_results = xapian_object.results @search_hits = xapian_object.matches_estimated @search_spelling = xapian_object.spelling_correction diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 6ac91c605..c052e4e1e 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_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: general_controller.rb,v 1.20 2008-04-30 00:37:50 francis Exp $ +# $Id: general_controller.rb,v 1.21 2008-04-30 00:46:00 francis Exp $ class GeneralController < ApplicationController @@ -35,7 +35,7 @@ class GeneralController < ApplicationController # Get all successful requests for display on the right query = 'variety:response (status:successful OR status:partially_successful)' sortby = "newest" - perform_search(query, sortby, 3) + perform_search(query, sortby, 'request_collapse', 3) end @@ -60,7 +60,7 @@ class GeneralController < ApplicationController combined = combined[0..-2] end query = combined.join("/") - perform_search(query, sortby) + perform_search(query, sortby, 'request_collapse') #render :controller => "help", :action => "about" end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index fbdfd3ca3..b169b7188 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.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: request_controller.rb,v 1.76 2008-04-22 10:11:00 francis Exp $ +# $Id: request_controller.rb,v 1.77 2008-04-30 00:46:00 francis Exp $ class RequestController < ApplicationController @@ -63,7 +63,7 @@ class RequestController < ApplicationController else raise "unknown request list view " + view.to_s end - perform_search(query, sortby) + perform_search(query, sortby, 'request_collapse') end # Page new form posts to diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index f3d83f776..43264be67 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.8 2008-04-24 23:52:59 francis Exp $ +# $Id: track_controller.rb,v 1.9 2008-04-30 00:46:00 francis Exp $ class TrackController < ApplicationController @@ -59,7 +59,7 @@ class TrackController < ApplicationController def atom_feed @track_thing = TrackThing.find(params[:track_id].to_i) - perform_search(@track_thing.track_query, @track_thing.params[:feed_sortby], 25, 1) + perform_search(@track_thing.track_query, @track_thing.params[:feed_sortby], nil, 25, 1) respond_to :atom end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index e75127667..43bc69259 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.99 2008-04-30 00:37:50 francis Exp $ +# $Id: info_request.rb,v 1.100 2008-04-30 00:46:01 francis Exp $ require 'digest/sha1' require 'vendor/plugins/acts_as_xapian/lib/acts_as_xapian' @@ -67,7 +67,7 @@ class InfoRequest < ActiveRecord::Base # Central function to do all searches # (Not really the right place to put it, but everything can get it here, and it # does *mainly* find info requests, via their events, so hey) - def InfoRequest.full_search(query, order, ascending, per_page, page, html_highlight) + def InfoRequest.full_search(query, order, ascending, collapse, per_page, page) # XXX handle order better # XXX html_highlight offset = (page - 1) * per_page @@ -75,8 +75,8 @@ class InfoRequest < ActiveRecord::Base [InfoRequestEvent, PublicBody, User], query, :offset => offset, :limit => per_page, :sort_by_prefix => order, - :sort_by_ascending => ascending -# :collapse_by_prefix => "request_collapse" # XXX fix this so off for email/RSS, on for web + :sort_by_ascending => ascending, + :collapse_by_prefix => collapse ) end @@ -87,7 +87,7 @@ class InfoRequest < ActiveRecord::Base t = Time.now.usec - t secs = t / 1000000.0 STDOUT.write secs.to_s + " query " + i.to_s + "\n" - results = InfoRequest.full_search(query, "created_at", false, 25, 1, false).results + results = InfoRequest.full_search(query, "created_at", false, nil, 25, 1).results end end diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 5bd41a715..908ee1621 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_mailer.rb,v 1.7 2008-04-24 23:52:59 francis Exp $ +# $Id: track_mailer.rb,v 1.8 2008-04-30 00:46:01 francis Exp $ class TrackMailer < ApplicationMailer def event_digest(user, email_about_things) @@ -41,7 +41,7 @@ class TrackMailer < ApplicationMailer end # Query for things in this track - xapian_object = InfoRequest.full_search(track_thing.track_query, 'created_at', false, 100, 1, false) + xapian_object = InfoRequest.full_search(track_thing.track_query, 'created_at', false, nil, 100, 1) # Go through looking for unalerted things alert_results = [] @@ -11,8 +11,6 @@ deployment: install it on the server make sure solr is stopped -XXX date range tips in search help -check that you aren't doing collapse_by for RSS / Email (via full_search) check emails look OK remove all the scripts in scripts/*solr* |