aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/track_controller.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-06-24 16:08:32 +0100
committerGareth Rees <gareth@mysociety.org>2014-06-25 10:40:38 +0100
commitf23b89f3474847cdd14ba892c5a7259964e18148 (patch)
tree2cf1440df2e9e8aeecd47ac2b25ec4f683bf0d6d /app/controllers/track_controller.rb
parente490c4a7ec7157e794d849c962371e298d8342d9 (diff)
Handle unhelpful stemming
Stemming returns 'bore' as the word to highlight which can't be matched in the original phrase. Also removes duplicates from the results
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r--app/controllers/track_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 551d9e72e..83700a55b 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -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(:regex => true), 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'],