aboutsummaryrefslogtreecommitdiffstats
path: root/spec/integration
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 /spec/integration
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 'spec/integration')
-rw-r--r--spec/integration/xapian_search_highlighting_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/integration/xapian_search_highlighting_spec.rb b/spec/integration/xapian_search_highlighting_spec.rb
index 7bd64c995..65a34cf91 100644
--- a/spec/integration/xapian_search_highlighting_spec.rb
+++ b/spec/integration/xapian_search_highlighting_spec.rb
@@ -26,4 +26,14 @@ describe 'highlighting search results' do
highlight_matches(phrase, matches).should == '<mark>department</mark>'
end
+ it 'highlights stemmed words even if the stem is unhelpful' do
+ # Stemming returns 'bore' as the word to highlight which can't be
+ # matched in the original phrase.
+ phrase = 'boring'
+ search = ActsAsXapian::Search.new([PublicBody], phrase, :limit => 1)
+ matches = search.words_to_highlight(:regex => true, :include_original => true)
+
+ highlight_matches(phrase, matches).should == '<mark>boring</mark>'
+ end
+
end