I am performing some basic search functions using ElasticSearch and Tire but the basic configuration of the snowball stemming analyzer has me stumped. I'm pretty much following the code example from the GitHub page: https://github.com/karmi/tire
Here's a Ruby sample file (Ruby 1.9.3, Tire 1.8.25):
require 'tire'
Tire.index 'videos' do
delete
create :mappings => {
:video => {
:properties => {
:code => { :type => 'string' },
:description => { :type => 'string', :analyzer => 'snowball' }
}
}
}
end
videos = [
{ :code => '1', :description => "some fight video" },
{ :code => '2', :description => "a fighting video" }
]
Tire.index 'videos' do
import videos
refresh
end
s = Tire.search 'videos' do
query do
string 'description:fight'
end
end
s.results.each do |document|
puts "* #{document.code} - #{document.description}"
end
I would have expected this to yield both records in the matches because fight and fighting have the same stem. However, it only returns the first record:
* 1 - some fight video
This would indicate that the default analyzer is being used rather than the one I'm configuring.
I am aware of passing the actual field in the query string per this question (ElasticSearch mapping doesn't work) and have successfully run this code so my ElasticSearch installation seems fine.
What do I need to change for Tire to return both records for this query (ie how do I get stemming working here)?