<% @show_tips = @xapian_requests.nil? || (@total_hits == 0) %> <% if @query.nil? %> <% @title = "Search Freedom of Information requests, public authorities and users" %>

<%=@title%>

<% elsif @total_hits == 0 %> <% @title = "Nothing found for '" + h(@query) + "'" %> <% else %> <% @title = "Results page " + @page.to_s %> <% end%> <% @include_request_link_in_authority_listing = true %> <% if @bodies && (@page == 1 || @xapian_bodies.results.size > 0) %>

Next, select the public authority you'd like to make the request from.

Can't find it? <%= link_to "Browse all", list_public_bodies_default %> or ask us to add it.

<% end %> <% form_tag({:action => "search_redirect"}, {:id => "search_form"}) do %>

<%= text_field_tag 'query', @query, { :size => 40 } %> <%= hidden_field_tag 'sortby', @inputted_sortby %> <% if @bodies %> <%= hidden_field_tag 'bodies', 1 %> <% end %> <%= submit_tag "Search" %> <% if not @show_tips %>   Advanced tips <% end %>

<% end %> <% if !@query.nil? %>

<%=link_to_unless @sortby == 'relevant', "Show most relevant results first", search_url(@query, 'relevant') %> | <%=link_to_unless @sortby == 'newest', "Newest results first", search_url(@query, 'newest') %> <% if @sortby == 'described' %> | Recently described results first <% end %>

<% end %> <% if @bodies && !@query.nil? && @xapian_bodies.results.size == 0 && @page == 1 %>

No public authorities found

<% if @spelling_correction %>

Did you mean: <%= search_link(@spelling_correction, @postfix) %>

<% end %>

<%=link_to "Browse all", list_public_bodies_default %> or ask us to add one.

<% end %> <% if @total_hits == 0 %>

<%=@title %>

<% end %> <% if not @query.nil? %> <% if @spelling_correction %>

Did you mean: <%= search_link(@spelling_correction, @postfix) %>

<% end %> <% if (!@bodies || @xapian_requests.results.size == 0) && @track_thing && (@xapian_bodies.results.size > 0 || @xapian_users.results.size > 0 || @total_hits == 0)%> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> <% end %> <% if @xapian_bodies.results.size > 0 %>

<%= "Public authorities " + ((@page-1)*@bodies_per_page+1).to_s + "-" + [@page*@bodies_per_page, @xapian_bodies.matches_estimated].min.to_s + " of " + @xapian_bodies.matches_estimated.to_s + " for '" + h(@query) + "'" %>

<% for result in @xapian_bodies.results %> <%= render :partial => 'body/body_listing_single', :locals => { :public_body => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> <% end %> <% if @xapian_users.results.size > 0 %>

<%= "People " + ((@page-1)*@users_per_page+1).to_s + "-" + [@page*@users_per_page, @xapian_users.matches_estimated].min.to_s + " of " + @xapian_users.matches_estimated.to_s + " for '" + h(@query) + "'" %>

<% for result in @xapian_users.results %> <%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %> <% end %> <% if @xapian_requests.results.size > 0 %>

<%= "FOI requests " + ((@page-1)*@requests_per_page+1).to_s + "-" + [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s + " of " + @xapian_requests.matches_estimated.to_s + " for '" + h(@query) + "'" %>

<% if @track_thing %> <%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> <% end %> <% for result in @xapian_requests.results %> <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> <% end %> <%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %> <% if @track_thing %>

<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %> <% end %> <% end %> <% end %> <% if @show_tips %>

Search tips

Table of statuses

<%=search_link('status:waiting_response')%> Waiting for the public authority to reply
<%=search_link('status:not_held')%> The public authority does not have the information requested
<%=search_link('status:rejected')%> The request was rejected by the public authority
<%=search_link('status:partially_successful')%> Some of the information requested has been received
<%=search_link('status:successful')%> All of the information requested has been received
<%=search_link('status:waiting_clarification')%> The public authority would like part of the request explained
<%=search_link('status:gone_postal')%> The public authority would like to / has responded by post
<%=search_link('status:internal_review')%> Waiting for the public authority to complete an internal review of their handling of the request
<%=search_link('status:error_message')%> Received an error message, such as delivery failure.
<%=search_link('status:requires_admin')%> A strange reponse, required attention by the WhatDoTheyKnow team
<%=search_link('status:user_withdrawn')%> The requester has abandoned this request for some reason

Table of varieties

<%=search_link('variety:sent')%> Original request sent
<%=search_link('variety:followup_sent')%> Follow up message sent by requester
<%=search_link('variety:response')%> Response from a public authority
<%=search_link('variety:comment')%> Annotation added to request
<%=search_link('variety:authority')%> A public authority
<%=search_link('variety:user')%> A WhatDoTheyKnow user
<% end %>