pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 468 forks source link

Delta index not working with multiple indexes on one model #195

Closed vdbilt closed 13 years ago

vdbilt commented 13 years ago

Having multiple indexes on one model (an additional one for building a dictionary in my case), I got an error when using delta indexes on the SECOND defined index in my model.

This is because assumed is that only the first defined index can/will have delta indexing. Am I correct? I got it working moving one above the other.

See in thinking-sphinx / lib / thinking_sphinx / active_record / delta.rb :

def delta_object
  self.sphinx_indexes.first.delta_object
end

In case this is desired behaviour (edge case), it might be good to mention this somewhere (e.g. http://freelancing-god.github.com/ts/en/deltas.html ).

Thanks! Gyuri

pat commented 13 years ago

I guess it's an edge case in that multiple indices isn't something that was in TS from the beginning. That said, I'll see if I can fix it :)

pat commented 13 years ago

Okay, TS should play nicely with one or more delta setups, no matter the order. Care to grab the latest source and give it a spin?

pat commented 13 years ago

Closing this, as it's fixed - if I've gotten it wrong, let me know.