elasticsearch - Stemming using Tire library -


i performing basic search functions using elasticsearch , tire basic configuration of snowball stemming analyzer has me stumped. i'm pretty following code example github page: https://github.com/karmi/tire

here's ruby sample file (ruby 1.9.3, tire 1.8.25):

require 'tire'  tire.index 'videos'   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'     import videos     refresh end  s = tire.search 'videos'    query       string 'description:fight'    end end  s.results.each |document|    puts "* #{document.code} - #{document.description}" end 

i have expected yield both records in matches because fight , fighting have same stem. however, returns first record:

* 1 - fight video 

this indicate default analyzer being used rather 1 i'm configuring.

i aware of passing actual field in query string per question (elasticsearch mapping doesn't work) , have run code elasticsearch installation seems fine.

what need change tire return both records query (ie how stemming working here)?

i have expected yield both records in matches because fight , fighting have same stem. however, returns first record:

right. 'fight' stems 'fight' , returns result "fight" in it. fighting same thing, unless set search index match otherwise.

if want behave way describe, you'll want make default index use edge ngram analyzer "fight" match "fighting" , return it. have, think desirable effect, of matching both 'fight' , 'fighting' if query "fighting" too.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -