aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-04-14 14:46:47 +0000
committerfrancis <francis>2008-04-14 14:46:47 +0000
commitc62db4918a9a4497fc85628bd07110e55ad8fac5 (patch)
tree176625fb26948485af522d2fa88c954c9dda3296 /app/models/info_request.rb
parent9f13a2297f2dd3c5e9a68025d8d07dd5571f78cd (diff)
Centralise call to multi_solr_search
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cf4d6c206..775138b84 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.84 2008-04-14 10:05:21 francis Exp $
+# $Id: info_request.rb,v 1.85 2008-04-14 14:46:48 francis Exp $
require 'digest/sha1'
@@ -111,6 +111,22 @@ class InfoRequest < ActiveRecord::Base
true
end
+ # Central function to do all searches
+ def InfoRequest.full_search(query, order, per_page, page, html_highlight)
+ offset = (page - 1) * per_page
+ return InfoRequestEvent.multi_solr_search(query, :models => [ PublicBody, User ],
+ :limit => per_page, :offset => offset,
+ :highlight => {
+ :prefix => html_highlight ? '<span class="highlight">' : "*",
+ :suffix => html_highlight ? '</span>' : "*",
+ :fragsize => 250,
+ :fields => ["solr_text_main", "title", # InfoRequestEvent
+ "name", "short_name", # PublicBody
+ "name" # User
+ ]}, :order => order
+ )
+ end
+
public
# When name is changed, also change the url name
def title=(title)