diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-08-28 15:43:46 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-08-28 15:43:46 +0100 |
commit | d801fff4325a42f1bbbb273ac0a4597c32b4dd4b (patch) | |
tree | 5b9d4828b2c6bf8415ccabb0140eb730ed12ceca /app/controllers/track_controller.rb | |
parent | 0b511943ef5a8835af34842291725d1dce74b25a (diff) | |
parent | 533f0ab5f402e110f42d50fb6906a6b58ae312f7 (diff) |
Merge remote-tracking branch 'origin/release/0.19'0.19
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r-- | app/controllers/track_controller.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index dccc52efc..83700a55b 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -82,7 +82,7 @@ class TrackController < ApplicationController def track_search_query @query = params[:query_array] - # XXX more hackery to make alternate formats still work with query_array + # TODO: more hackery to make alternate formats still work with query_array if /^(.*)\.json$/.match(@query) @query = $1 params[:format] = "json" @@ -154,7 +154,15 @@ class TrackController < ApplicationController request.format = 'xml' unless params[:format] respond_to do |format| format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true, - lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) } + lambda do |t| + view_context.highlight_and_excerpt( + t, + @xapian_object.words_to_highlight( + :regex => true, + :include_original => true), + 150 + ) + end ) } } format.any { render :template => 'track/atom_feed', :formats => ['atom'], |