0
votes

i need your help to solve an issue in Thinking Sphinx.
i am Using 'sphinx-2.0.5-win32' and following gems
gem 'thinking-sphinx', '2.0.13' and gem 'riddle', '1.5.3'

sphinx.yml contains
development:
min_infix_len: 3
charset_table: "0..9, A..Z->a..z, _, a..z, -, U+410..U+42F->U+430..U+44F, U+430..U+44F, ., %, @, #, &, *, $"
binlog_path: '#'

My model file :
Class Rm
define_index do
set_property :delta => true
indexes :code, :as => :rm_code, :sortable => true
has id
end
end


I am searching like this :
Rm.search Riddle.escape('"rm0001"'), :page => params[:page], :per_page => 25, :match_mode => :extended -----------> getting 2 results

Code

rm0001
rm0001N


I want only 'rm0001' in search results,
Please help me

Thanks in advance.
Praveen

1
What happens if you don't escape the search query? I'm pretty sure quotes get escaped, and that's not what you want. - pat
I tried like this, Rm.search '"rm0001"', :match_mode => :extended, but still getting 2 results.I think may be i should define Multiple Indices with ':min_infix_len => 0' and use it. - Praveen
Oh yeah, it's definitely the min_infix_len that'll be causing the problem. I guess a second index with that set to zero and then only searching on that index should do the trick. - pat

1 Answers

0
votes

You´ve set min_infix_len - which enables part word matches.

But NOT set enable_star=true, which means that querys are automatically part word.

So either remove min_infix_len to disable part word matches, OR set enable_star so that part word matches only happen when include * at star/end of words.