views:

195

answers:

2

I've been trying to get Thinking Sphinx for Ruby to handle prefixes and/or star, and every time i generate a new configuration file, it seems to ignore it.

Here's the line I added:

define_index do
    [... Stuff ...]
    set_property :min_prefix_len => 1
end

And then I run:

rake ts:config
rake ts:in
rake ts:run

And nothing new. I keep checking the config file, and it never changes due to this. I even manually go in and change the file, and then in is replaced with a file without anything relating to min_prefix. Any thoughts?


Edit --

I don't have a .yml file right now.

+2  A: 

I've just tested this on my local machine, and it's not working for me either... I'll see if I can find the source of the bug. My mistake, got the setting key wrong. It actually works fine for me.

So, what version of Thinking Sphinx are you using? What else is in your index definition? Do you have a sphinx.yml file? If so, what's in it?

Also, it's probably worth continuing this discussion on the Google group - it's a bit better for back-and-forth debugging.

pat
Will do... i'll post back here when I find out more.
aronchick
Ok, i've upgraded, and now I've added the two index names (index_name 'prefix index') to the define_index statements... here's the response:ERROR: section 'library_core_0' (type='source') already exists [...]
aronchick
You shouldn't need to add index_name directives in your `define_index` blocks.
Jason Yanowitz
you do if you have multiple indexes on the same table
aronchick
+2  A: 

The answer to the question ended up being:

-Upgrade to more recent version of TS - older versions (<1.3.14) do not support multiple indexes

-The define index blocks need to be setup like this:

  define_index 'library_index' do
     [...]
  end

  define_index 'prefix_library_index' do
     [...]
     set_property :min_prefix_len => 1
  end

-Calling the search function needs to specify the index or it will search across all indexes -

Library.search(keyword, { index => 'prefix_libary_index', <other params here> } )
aronchick