From 42870985da06418461c847563fa860c11b4094a1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 10 Jun 2014 10:04:29 +0100 Subject: Rename XXX comments with TODO: Picks these up in `rake notes` and adds semantic meaning --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index dccc52efc..c15fb573d 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" -- cgit v1.2.3 From 4d9c89d0e416825eb52a720d74230f547454ba31 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 30 May 2014 15:48:10 +0100 Subject: Use regex based highlighting --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index c15fb573d..551d9e72e 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -154,7 +154,7 @@ 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 { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight(:regex => true), 150) } ) } } format.any { render :template => 'track/atom_feed', :formats => ['atom'], -- cgit v1.2.3 From f23b89f3474847cdd14ba892c5a7259964e18148 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 24 Jun 2014 16:08:32 +0100 Subject: 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 --- app/controllers/track_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') 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'], -- cgit v1.2.3