views:

1118

answers:

4

In my app, I need every new record to be added to the index instantly (not after rake ts:index). If I understand it correctly delta indexing is what I'm looking for. So, I added delta column to every table I'm indexing with Sphinx, set the default value to false and added set_property :delta => true to every define_index block; then ran rake ts:index and rake ts:restart. However, the "instant" indexing doesn't seem to work. When testing in console I create a new record, save it and try to search it but won't get it back (after I run rake ts:index it works just fine). Am I doing something wrong here?

A: 

Hi Milan

What version of Rails are you using? Is there any output when you create a new record in script/console?

pat
A: 

Hi,

do you use rake ts:conf after to correctly generate the config file ?

You can check then the config file generated to see if there is both SQL requests (the standard and the delta) in the config file.

We use it without problem.

tal
+1  A: 

Hi guys, thank you for your efforts. After some pretty long exploration I found out that I just forgot to run the migration (which set the default value for delta columns to false). Now, I should get some minus points for such a stupid mistake. Sorry for bothering you and thank you once again.

Milan Novota
No way on the minus points. Somebody else will make the same mistake and now they can google and find the solution. Your pain is someone else's gain.
srboisvert
A: 

I'm having a similar problem with delta indexing not working...actually it works in my dev environment but not production. I'm confused by the statements at the beginning of the post which indicate that the default value for delta should be false. In the thinking sphinx doc at http://freelancing-god.github.com/ts/en/deltas.html it states the default value should be true:

def self.up
  add_column :articles, :delta, :boolean, :default => true,
    :null => false
end

Am I missing something?

Thanks!