pat / thinking-sphinx

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

How Real Time work? #1072

Closed Vlagilen closed 7 years ago

Vlagilen commented 7 years ago

The problem is that every time I add a new record into the database, I come to run the "ts:rebuild" or "ts:regenerate" command. Otherwise, new records are not searched, this is not very convenient. I thought that the option "real-time" would fix this. Or does it work like that otherwise?

pat commented 7 years ago

Hi there,

With real-time indices, along with the index configuration, you also need to add a callback in your model: https://freelancing-gods.com/thinking-sphinx/real_time.html#model-callbacks This will ensure that any changes to your model is then reflected in Sphinx.

It's still recommended that you run ts:index (or ts:generate if you're on a version of TS prior to v3.4.0) on a regular basis, to ensure any data changes that don't fire callbacks are reflected in Sphinx as well.

Vlagilen commented 7 years ago

Now everything works. I'm using latest version. Thanks !