views:

19

answers:

1

Hi, I have created my search part successfully with the thinking_sphinx gem and I have searched a word it is showing correct, But the problem with the search is it need full word to be given to search exact match. I dont want to give exact word instead any particular character or part of words also be taken into account. help me to solve this problem..

example

say my word is "Sample"

instead of giving sample i need to specify part of the word like.

amp or ple

for rails code we will specify

find :all, :conditions => ["user_id like ? ", "%#{search}%"]

how to specify this, by using thinking_sphinx gem.

i tried with,

  User.search "*amp*"

but of no result guide me to solve this.

+1  A: 

Got the Result,

At first I have added

development:
      enable_star: 1
      min_infix_len: 3

on config -> sphinx.yml

and I have rebuild my application by using

rake ts:rebuild

and then on controller,

User.search "*mple", :star => true

which result,

sample
Senthil Kumar Bhaskaran
You should only have either infix _or_ prefix - Sphinx doesn't like it if you use both. In your case, you'll want infix - which includes prefixes and suffixes.
pat