aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/general_controller.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-03-06 21:49:33 +0000
committerfrancis <francis>2008-03-06 21:49:33 +0000
commitda6ab0fbcec800b0e8548048ff7e19e4cbd7f7f7 (patch)
tree04b10f2fc75034923eb7204e6c2b47135157f544 /app/controllers/general_controller.rb
parent092d674f2c1825be04b65c4e9b9de8fc10fe44f6 (diff)
Highlighting
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r--app/controllers/general_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 1f8c46648..342355c75 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.2 2008-03-06 20:10:29 francis Exp $
+# $Id: general_controller.rb,v 1.3 2008-03-06 21:49:33 francis Exp $
class GeneralController < ApplicationController
@@ -47,6 +47,11 @@ class GeneralController < ApplicationController
def search
@per_page = 20
query = params[:query]
+
+ query_nopunc = query.gsub(/[^a-z0-9]/i, " ")
+ query_nopunc = query_nopunc.gsub(/\s+/, " ")
+ @highlight_words = query_nopunc.split(" ")
+
@solr_object = InfoRequest.multi_solr_search(query, :models => [ OutgoingMessage, IncomingMessage ],
:limit => @per_page, :offset => ((params[:page]||"1").to_i-1) * @per_page)
@search_results = @solr_object.results