aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/general_controller.rb8
-rw-r--r--app/models/incoming_message.rb7
-rw-r--r--app/models/info_request.rb71
-rw-r--r--app/models/info_request_event.rb90
-rw-r--r--app/models/outgoing_message.rb13
-rw-r--r--app/models/public_body.rb6
-rw-r--r--app/models/user.rb8
-rw-r--r--app/views/general/search.rhtml20
-rw-r--r--app/views/layouts/default.rhtml8
-rw-r--r--app/views/request/_request_listing_single.rhtml13
-rw-r--r--app/views/request/_request_listing_via_event.rhtml41
-rw-r--r--app/views/request/_request_listing_via_incoming.rhtml18
-rw-r--r--app/views/request/_request_listing_via_outgoing.rhtml24
-rw-r--r--spec/controllers/general_controller_spec.rb8
-rw-r--r--todo.txt11
15 files changed, 188 insertions, 158 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 829ac829e..6463ca556 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.10 2008-03-19 03:05:25 francis Exp $
+# $Id: general_controller.rb,v 1.11 2008-03-31 17:20:58 francis Exp $
class GeneralController < ApplicationController
@@ -64,15 +64,13 @@ class GeneralController < ApplicationController
end
# Peform the search
- solr_object = InfoRequest.multi_solr_search(@query, :models => [ OutgoingMessage, IncomingMessage, PublicBody, User ],
+ solr_object = InfoRequestEvent.multi_solr_search(@query, :models => [ PublicBody, User ],
:limit => @per_page, :offset => (@page - 1) * @per_page,
:highlight => {
:prefix => '<span class="highlight">',
:suffix => '</span>',
:fragsize => 250,
- :fields => ["title", "initial_request_text", # InfoRequest
- "body", # OutgoingMessage
- "get_text_for_indexing", # IncomingMessage
+ :fields => ["solr_text_main", "title", # InfoRequestEvent
"name", "short_name", # PublicBody
"name" # User
]}, :order => order
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 8e6783495..83e16d92c 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -17,7 +17,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.69 2008-03-21 14:45:38 francis Exp $
+# $Id: incoming_message.rb,v 1.70 2008-03-31 17:20:58 francis Exp $
# TODO
@@ -72,11 +72,6 @@ class IncomingMessage < ActiveRecord::Base
has_many :outgoing_message_followups, :class_name => OutgoingMessage
- acts_as_solr :fields => [
- :get_text_for_indexing,
- { :created_at => :date }
- ], :if => "$do_solr_index"
-
# Return the structured TMail::Mail object
# Documentation at http://i.loveruby.net/en/projects/tmail/doc/
def mail
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 353c84105..8c626d2e6 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -22,7 +22,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.73 2008-03-25 17:25:09 francis Exp $
+# $Id: info_request.rb,v 1.74 2008-03-31 17:20:59 francis Exp $
require 'digest/sha1'
@@ -64,34 +64,6 @@ class InfoRequest < ActiveRecord::Base
end
# Full text search indexing
- acts_as_solr :fields => [
- :title,
- :initial_request_text,
- { :status => :string },
- { :requested_by => :string },
- { :requested_from => :string },
- { :created_at => :date },
- { :type => :string} # see "def type" below
- ], :if => "$do_solr_index"
- def status # for name in Solr queries
- calculate_status
- end
- def requested_by
- self.user.url_name
- end
- def requested_from
- self.public_body.url_name
- end
- # acts_on_solr indexes things with type: anyway but by default does text (full text)
- # rather than string (flag) indexing for it. The entry in acts_on_solr above forces
- # the type to be string, and this function returns the same value as acts_on_solr would
- # anyway. Also, only needs to happen in this one model, as others are
- # covered automatically by the multi solr search query command, which treats types same
- # across all models.
- def type
- "InfoRequest"
- end
-
$do_solr_index = false
$do_solr_index_marking = false
def InfoRequest.update_solr_index
@@ -106,32 +78,28 @@ class InfoRequest < ActiveRecord::Base
info_request = InfoRequest.find(id, :lock =>true)
do_index = (info_request.prominence != 'backpage')
- if do_index
- if not info_request.solr_save
- raise "failed to solr_save"
- end
- else
- if not info_request.solr_destroy
- raise "failed to solr_destroy"
+ # fill in any missing event states for all responses - so responses which
+ # have not been described get the status of later ones.
+ events = info_request.info_request_events.find(:all, :order => "created_at")
+ curr_state = info_request.described_state
+ for event in events.reverse
+ if event.event_type == 'response'
+ if not event.described_state.nil?
+ curr_state = event.described_state
+ end
+ event.described_state = curr_state
end
end
- for outgoing_message in info_request.outgoing_messages
- # Initial request text is indexed for InfoRequest models -
- # see :initial_request_text in acts_as_solr entry above
- if do_index and outgoing_message.message_type != 'initial_request'
- outgoing_message.solr_save
+ # index all the events
+ for event in events
+ if do_index and event.indexed_by_solr
+ event.solr_save
else
- outgoing_message.solr_destroy
- end
- end
- for incoming_message in info_request.incoming_messages
- if do_index
- incoming_message.solr_save
- else
- incoming_message.solr_destroy
+ event.solr_destroy
end
end
+
$do_solr_index = false # disable indexing again while we save it, or else destroyed things get put back
$do_solr_index_marking = true # but record that we want to set solr_up_to_date to be true, so before_update doesn't clobber it
info_request.solr_up_to_date = true
@@ -141,7 +109,7 @@ class InfoRequest < ActiveRecord::Base
$do_solr_index = true
end
end
- InfoRequest.solr_optimize
+ InfoRequestEvent.solr_optimize
$do_solr_index = false
end
def before_update
@@ -412,8 +380,7 @@ public
return ""
end
messages = self.outgoing_messages.find(:all, :order => "created_at")
- excerpt = messages[0].body
- excerpt.sub!(/Dear .+,/, "")
+ excerpt = messages[0].body_without_salutation
return excerpt
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index a6f67c4fd..20340e540 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -16,7 +16,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.25 2008-03-24 09:35:23 francis Exp $
+# $Id: info_request_event.rb,v 1.26 2008-03-31 17:20:59 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
@@ -47,6 +47,63 @@ class InfoRequestEvent < ActiveRecord::Base
'requires_admin'
]
+ # Full text search indexing
+ acts_as_solr :fields => [
+ { :solr_text_main => :text },
+ { :title => :text },
+ { :status => :string },
+ { :requested_by => :string },
+ { :requested_from => :string },
+ { :created_at => :date },
+ { :variety => :string }
+ ], :if => "$do_solr_index"
+ def status # for name in Solr queries
+ self.info_request.calculate_status
+ end
+ def requested_by
+ if self.event_type == 'sent'
+ self.info_request.user.url_name
+ else
+ nil
+ end
+ end
+ def requested_from
+ if self.event_type == 'sent'
+ self.info_request.public_body.url_name
+ else
+ nil
+ end
+ end
+ def solr_text_main
+ text = ''
+ if self.event_type == 'sent'
+ text = text + self.outgoing_message.body_without_salutation + "\n\n"
+ elsif self.event_type == 'followup_sent'
+ text = text + self.outgoing_message.body_without_salutation + "\n\n"
+ elsif self.event_type == 'response'
+ text = text + self.incoming_message.get_text_for_indexing + "\n\n"
+ else
+ # nothing
+ end
+ return text
+ end
+ def title
+ if self.event_type == 'sent'
+ return self.info_request.title
+ end
+ return ''
+ end
+ def indexed_by_solr
+ if ['sent', 'followup_sent', 'response'].include?(self.event_type)
+ return true
+ else
+ return false
+ end
+ end
+ def variety
+ self.event_type
+ end
+
# We store YAML version of parameters in the database
def params=(params)
self.params_yaml = params.to_yaml
@@ -59,7 +116,7 @@ class InfoRequestEvent < ActiveRecord::Base
# XXX search for the find below and call this function more instead
def incoming_message
if not ['response'].include?(self.event_type)
- raise "only call incoming_message for response events"
+ return nil
end
if not self.params[:incoming_message_id]
@@ -73,7 +130,7 @@ class InfoRequestEvent < ActiveRecord::Base
# XXX search for the find below and call this function more instead
def outgoing_message
if not [ 'edit_outgoing', 'sent', 'resent', 'followup_sent' ].include?(self.event_type)
- raise "only call outgoing_message for appropriate event types"
+ return nil
end
if not self.params[:outgoing_message_id]
@@ -83,6 +140,33 @@ class InfoRequestEvent < ActiveRecord::Base
return OutgoingMessage.find(self.params[:outgoing_message_id].to_i)
end
+ # Display version of status
+ def display_status
+ if incoming_message.nil?
+ raise "display_status only works for incoming messages right now"
+ end
+ status = self.described_state
+ raise status.to_s
+ if status == 'waiting_response'
+ "Acknowledgement"
+ elsif status == 'waiting_clarification'
+ "Clarification request"
+ elsif status == 'not_held'
+ "Information not held"
+ elsif status == 'rejected'
+ "Rejection"
+ elsif status == 'partially_successful'
+ "Partially successful response"
+ elsif status == 'successful'
+ "Successful response"
+ elsif status == 'requires_admin'
+ "Unusual response"
+ else
+ raise "unknown status " + status
+ end
+ end
+
+
end
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 20e2d33ec..0d959cb25 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.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: outgoing_message.rb,v 1.38 2008-03-21 14:45:38 francis Exp $
+# $Id: outgoing_message.rb,v 1.39 2008-03-31 17:20:59 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
@@ -32,11 +32,6 @@ class OutgoingMessage < ActiveRecord::Base
belongs_to :incoming_message_followup, :foreign_key => 'incoming_message_followup_id', :class_name => 'IncomingMessage'
- acts_as_solr :fields => [
- :body,
- { :created_at => :date }
- ], :if => "$do_solr_index"
-
# How the default letter starts and ends
def get_salutation
ret = "Dear "
@@ -55,6 +50,12 @@ class OutgoingMessage < ActiveRecord::Base
end
end
+ def body_without_salutation
+ ret = self.body
+ ret.sub!(/Dear .+,/, "")
+ return ret
+ end
+
# Set default letter
def after_initialize
if self.body.nil?
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 2403a97d8..d900e0852 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.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: public_body.rb,v 1.47 2008-03-25 17:25:09 francis Exp $
+# $Id: public_body.rb,v 1.48 2008-03-31 17:20:59 francis Exp $
require 'csv'
require 'set'
@@ -73,9 +73,9 @@ class PublicBody < ActiveRecord::Base
{:name => { :boost => 10.0 }},
{:short_name => { :boost => 10.0 }},
{ :created_at => :date },
- { :moo => :string }
+ { :variety => :string }
]
- def moo
+ def variety
"authority"
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 1bbbdb83a..09686f7d9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -20,7 +20,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.41 2008-03-25 17:25:09 francis Exp $
+# $Id: user.rb,v 1.42 2008-03-31 17:20:59 francis Exp $
require 'digest/sha1'
@@ -41,8 +41,12 @@ class User < ActiveRecord::Base
acts_as_solr :fields => [
{:name => { :boost => 5.0 }},
- { :created_at => :date }
+ { :created_at => :date },
+ { :variety => :string }
]
+ def variety
+ "user"
+ end
def validate
errors.add(:email, "doesn't look like a valid address") unless MySociety::Validate.is_valid_email(self.email)
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index 3b5661ee3..9f021e540 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -1,5 +1,5 @@
<% if @query.nil? %>
- <% @title = "Search Freedom of Information requests, public bodies and users" %>
+ <% @title = "Search Freedom of Information requests, public authorities and users" %>
<h1><%=@title%></h1>
<% elsif @search_hits == 0 %>
<% @title = "Nothing found for '" + h(@query) + "'" %>
@@ -28,16 +28,12 @@
<% if @search_results.empty? %>
<% else %>
<% for search_result in @search_results %>
- <% if search_result.class.to_s == 'InfoRequest' %>
- <%= render :partial => 'request/request_listing_single', :locals => { :info_request => search_result } %>
- <% elsif search_result.class.to_s == 'OutgoingMessage' %>
- <%= render :partial => 'request/request_listing_via_outgoing', :locals => { :info_request => search_result.info_request, :outgoing_message => search_result } %>
- <% elsif search_result.class.to_s == 'IncomingMessage' %>
- <%= render :partial => 'request/request_listing_via_incoming', :locals => { :info_request => search_result.info_request, :incoming_message => search_result } %>
- <% elsif search_result.class.to_s == 'PublicBody' %>
+ <% if search_result.class.to_s == 'PublicBody' %>
<%= render :partial => 'body/body_listing_single', :locals => { :public_body => search_result } %>
<% elsif search_result.class.to_s == 'User' %>
<%= render :partial => 'user/user_listing_single', :locals => { :display_user => search_result } %>
+ <% elsif search_result.class.to_s == 'InfoRequestEvent' %>
+ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => search_result, :info_request => search_result.info_request } %>
<% else %>
<p><strong>Unknown search result type <%=search_result.class.to_s%></strong></p>
<% end %>
@@ -53,10 +49,10 @@
<li>Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong></li>
<li>Use OR (in capital letters) where you don't mind which word, e.g. <strong>commons OR lords</strong>
<li>Use quotes when you want to find an exact phrase, e.g. <strong>"Liverpool City Council"</strong>
- <li>Type <strong>status:</strong> to select based on the status of the request, see table below.
- <li><strong>requested_from:home_office</strong>, typing the name as in the URL, to restrict to requests from the Home Office.
- <li><strong>requested_by:francis_irving</strong>, typing the name as in the URL, to restrict to requests made by Francis Irving.
- <li><strong>type:</strong> with value InfoRequest, OutgoingMessage, IncomingMessage, PubicBody or User to select type of thing being searched for
+ <li><strong>variety:</strong> with value sent, followup_sent, response, authority or user to select type of thing to search for.
+ <li>Type <strong>status:</strong> to select based on the status of the request or the status that the response caused, see table below.
+ <li><strong>requested_from:home_office</strong> to restrict to requests from the <%= link_to "Home Office", show_public_body_url(:url_name => 'home_office') %>, typing the name as in the URL.
+ <li><strong>requested_by:julian_todd</strong> to restrict to requests made by <%= link_to "Julian Todd", show_user_url(:url_name => 'julian_todd') %>, typing the name as in the URL.
<li>Read about <a href="http://lucene.apache.org/java/docs/queryparsersyntax.html">advanced search operators</a>, such as fuzziness and proximity.
</ul>
diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml
index f09684b81..9d9044339 100644
--- a/app/views/layouts/default.rhtml
+++ b/app/views/layouts/default.rhtml
@@ -23,11 +23,11 @@
</div>
</div>
<ul id="navigation">
- <li><a href="/">Make Request</a></li>
- <li><%= link_to "View Requests", request_list_url %></li>
- <li><%= link_to "View Authorities", list_public_bodies_url(:tag => 'department') %></li>
+ <li><a href="/">Make request</a></li>
+ <li><%= link_to "View requests", request_list_url %></li>
+ <li><%= link_to "View authorities", list_public_bodies_url(:tag => 'department') %></li>
<% if @user %>
- <li><%=link_to "My Requests", user_url(@user) %></li>
+ <li><%=link_to "My requests", user_url(@user) %></li>
<% end %>
<li><%= link_to "About", about_url %></li>
</ul>
diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.rhtml
index be419b8f7..f50627a5f 100644
--- a/app/views/request/_request_listing_single.rhtml
+++ b/app/views/request/_request_listing_single.rhtml
@@ -1,17 +1,8 @@
<p class="request_listing">
- <% if not @highlighting.nil? and @highlighting['InfoRequest'][info_request.id].include?('title') %>
- <%= link_to @highlighting['InfoRequest'][info_request.id]["title"], request_url(info_request) %>
- <% @highlighting['InfoRequest'][info_request.id].delete("title") %>
- <% else %>
- <%= link_to h(info_request.title), request_url(info_request) %>
- <% end %>
+ <%= link_to h(info_request.title), request_url(info_request) %>
<br>
- <% if not @highlighting.nil? and @highlighting['InfoRequest'][info_request.id].size > 0 %>
- <%= @highlighting['InfoRequest'][info_request.id].values.join(" ") %>
- <% else %>
- <%= excerpt(info_request.initial_request_text, "", 150) %>
- <% end %>
+ <%= excerpt(info_request.initial_request_text, "", 150) %>
<br>
<span class="request_listing_bottomline">
diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml
new file mode 100644
index 000000000..91af64ccf
--- /dev/null
+++ b/app/views/request/_request_listing_via_event.rhtml
@@ -0,0 +1,41 @@
+<p class="request_listing">
+
+ <% if not @highlighting.nil? and @highlighting['InfoRequestEvent'][event.id].include?('title') %>
+ <%= link_to @highlighting['InfoRequestEvent'][event.id]["title"], request_url(info_request) %>
+ <% @highlighting['InfoRequestEvent'][event.id].delete("title") %>
+ <% elsif not event.incoming_message.nil? %>
+ <%= link_to "Response to '" + h(info_request.title) + "'", request_url(info_request)+"#incoming-"+event.incoming_message.id.to_s %>
+ <% elsif not event.outgoing_message.nil? and event.event_type == 'followup_sent' %>
+ <%= link_to "Follow up message for '" + h(info_request.title) + "'", request_url(info_request)+"#outgoing-"+event.outgoing_message.id.to_s %>
+ <% else %>
+ <%= link_to h(info_request.title), request_url(info_request) %>
+ <% end %>
+
+ <br>
+ <% if not @highlighting.nil? and @highlighting['InfoRequestEvent'][event.id].size > 0 %>
+ <%= @highlighting['InfoRequestEvent'][event.id].values.join(" ") %>
+ <% else %>
+ <%= excerpt(info_request.initial_request_text, "", 150) %>
+ <% end %>
+ <br>
+
+ <span class="request_listing_bottomline">
+
+ <% if event.event_type == 'sent' %>
+ <strong>Request</strong> sent to <%= public_body_link(info_request.public_body) %>
+ by <%= user_link(info_request.user) %>
+ <% elsif event.event_type == 'followup_sent' %>
+ <strong>Follow up</strong> sent to <%= public_body_link(info_request.public_body) %>
+ by <%= user_link(info_request.user) %>
+ <% elsif event.event_type == 'response' %>
+ <% # <strong> XXX <%=event.display_status %> <%= info_request.display_status %> </strong> %>
+ <strong>Response</strong> by <%= public_body_link(info_request.public_body) %>
+ to <%= user_link(info_request.user) %>
+ <% else %>
+ <% raise "unknown event type indexed " + event.event_type %>
+ <% end %>
+
+ on <%= simple_date(event.created_at) %>.
+ </span>
+</p>
+
diff --git a/app/views/request/_request_listing_via_incoming.rhtml b/app/views/request/_request_listing_via_incoming.rhtml
deleted file mode 100644
index 3f7026cc4..000000000
--- a/app/views/request/_request_listing_via_incoming.rhtml
+++ /dev/null
@@ -1,18 +0,0 @@
-<p class="request_listing">
- <%= link_to "Response to '" + h(info_request.title) + "'", request_url(info_request)+"#incoming-"+incoming_message.id.to_s %>
-
- <br>
- <%= @highlighting['IncomingMessage'][incoming_message.id].values.join(" ") %>
- <br>
-
- <span class="request_listing_bottomline">
- <strong>
- <%= info_request.display_status %>
- </strong>
-
- Response by <%= public_body_link(info_request.public_body) %>
- to <%= user_link(info_request.user) %>
- on <%= simple_date(incoming_message.sent_at) %>.
- </span>
-</p>
-
diff --git a/app/views/request/_request_listing_via_outgoing.rhtml b/app/views/request/_request_listing_via_outgoing.rhtml
deleted file mode 100644
index 55af9fa6c..000000000
--- a/app/views/request/_request_listing_via_outgoing.rhtml
+++ /dev/null
@@ -1,24 +0,0 @@
-<p class="request_listing">
- <% if outgoing_message.message_type == 'initial_request' %>
- <% raise "initial_request shouldn't be indexed for search, text is indexed in InfoRequest model" %>
- <% elsif outgoing_message.message_type == 'followup' %>
- <%= link_to "Follow up message for '" + h(info_request.title) + "'", request_url(info_request)+"#outgoing-"+outgoing_message.id.to_s %>
- <% else %>
- <% raise "unknown outgoing message type" %>
- <% end %>
-
- <br>
- <%= @highlighting['OutgoingMessage'][outgoing_message.id].values.join(" ") %>
- <br>
-
- <span class="request_listing_bottomline">
- <strong>
- <%= info_request.display_status %>
- </strong>
-
- Follow up sent to <%= public_body_link(info_request.public_body) %>
- by <%= user_link(info_request.user) %>
- on <%= simple_date(outgoing_message.created_at) %>.
- </span>
-</p>
-
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 52350ec80..9cda74ae7 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -31,10 +31,10 @@ describe GeneralController, "when searching" do
response.should render_template('search')
assigns[:search_hits].should == 1
- assigns[:search_results].should == [ info_requests(:fancy_dog_request) ]
+ assigns[:search_results].should == [ info_request_events(:useless_outgoing_message_event) ]
assigns[:highlight_words].should == ["fancy", "dog"]
- assigns[:highlighting]["InfoRequest"][101]["initial"][0].should include('Why do you have such a <span class="highlight">fancy</span> <span class="highlight">dog</span>?')
+ assigns[:highlighting]["InfoRequestEvent"][900]["solr"][0].should include('Why do you have such a <span class="highlight">fancy</span> <span class="highlight">dog</span>?')
end
it "should show help when searching for nothing" do
@@ -53,7 +53,7 @@ describe GeneralController, "when searching" do
response.should render_template('search')
assigns[:search_hits].should == 2
- assigns[:search_results].should == [ public_bodies(:geraldine_public_body), incoming_messages(:useless_incoming_message) ]
+ assigns[:search_results].should == [ public_bodies(:geraldine_public_body), info_request_events(:useless_incoming_message_event) ]
end
it "should find incoming message and public body (in that order) when searching for 'geraldine quango', newest first" do
@@ -65,7 +65,7 @@ describe GeneralController, "when searching" do
response.should render_template('search')
assigns[:search_hits].should == 2
- assigns[:search_results].should == [ incoming_messages(:useless_incoming_message), public_bodies(:geraldine_public_body) ]
+ assigns[:search_results].should == [ info_request_events(:useless_incoming_message_event), public_bodies(:geraldine_public_body) ]
end
diff --git a/todo.txt b/todo.txt
index cb1315c75..a1525b820 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,13 +1,6 @@
-CVS commit:
-
-Fix up url names for info requests and users so don't end in _
-
Search:
-Search for successful requests now has bogus date order :( Doesn't fit in
- with paradigm of request / incoming message being separate objects.
-Perhaps we should be indexing events
- or maybe index success/failure by type known for message?
+Check date order of search fo successful requests
Successful requests should have success date as date in search results.
As a result fix up sorting in general
@@ -164,6 +157,8 @@ Quoting fixing TODO:
http://www.whatdotheyknow.com/request/55/response/96
http://www.whatdotheyknow.com/request/71/response/108
http://www.whatdotheyknow.com/request/police_powers_to_inform_car_insu
+Char encoding:
+ http://www.whatdotheyknow.com/request/107/response/144
Sources of public bodies
========================