aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb12
-rw-r--r--app/views/general/new_frontpage.rhtml4
2 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index d0b6f8999..b4de641b7 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.37 2008-09-05 09:05:05 francis Exp $
+# $Id: general_controller.rb,v 1.38 2008-09-05 09:16:23 francis Exp $
class GeneralController < ApplicationController
@@ -41,7 +41,15 @@ class GeneralController < ApplicationController
# New, improved front page!
def new_frontpage
@popular_bodies = PublicBody.find(:all, :select => "*, (select count(*) from info_requests where info_requests.public_body_id = public_bodies.id) as c", :order => "c desc", :limit => 8)
- @random_requests = InfoRequest.find(:all, :order => "random()", :limit => 8, :conditions => ["described_state = ? and prominence = ?", 'successful', 'normal'] )
+
+ # This is too slow
+ #@random_requests = InfoRequest.find(:all, :order => "random()", :limit => 8, :conditions => ["described_state = ? and prominence = ?", 'successful', 'normal'] )
+
+ # Get somesuccessful requests
+ query = 'variety:response (status:successful OR status:partially_successful)'
+ sortby = "described"
+ @xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', 8)
+ @successful_requests = @xapian_object.results.map { |r| r[:model].info_request }
end
# Just does a redirect from ?query= search to /query
diff --git a/app/views/general/new_frontpage.rhtml b/app/views/general/new_frontpage.rhtml
index ef317ec57..b02c49682 100644
--- a/app/views/general/new_frontpage.rhtml
+++ b/app/views/general/new_frontpage.rhtml
@@ -4,7 +4,7 @@
<% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>
<p>
<strong>First, type in the name of the UK public authority
- <br>or anything to search for</strong>
+ <br>you'd like information from OR anything to search for</strong>
<br>
<%= text_field_tag 'query', params[:query], { :size => 30 } %>
<%= hidden_field_tag 'bodies', 1 %>
@@ -27,7 +27,7 @@
<div id="examples_1">
<ul>
- <% for request in @random_requests %>
+ <% for request in @successful_requests %>
<li><%=link_to h(excerpt(request.title, "", 35)), request_url(request)%> </li>
<% end %>
</ul>