On 23/07/2013, at 6:18 AM, Daniel Vandersluis wrote:
> Sorry for all the threads I've been creating lately, I appreciate your help
> and the work you've put into TS! :)
>
> Given that indexing is suddenly taking so long and so much space, naturally I
> have begun exploring delta index issues, and have a few questions. The
> documentation page does not seem to be updated for TS3 (is there another doc
> page somewhere I can look at), so I hope you wouldn't mind answering the
> following:
The theory in those docs remains correct, but the syntax has changed. I'll try
to get around to updating that soon. In the meantime, read on...
> • Delta indexing seems to be triggered by saving a record, inline with
> the process, is that correct?
With the default approach, yes this is correct.
> • If so, is there an option to run delta indexing outside of the
> request process? Is that what the DJ delta gem is for, and is that set up for
> TS3?
Yup, that's what ts-delayed-delta is for (and ts-resque-delta and
ts-sidekiq-delta). The latest ts-delayed-delta release is what you'll need for
TS v3, but if you prefer Resque:
gem 'ts-resque-delta',
:git => 'git://github.com/pat/ts-resque-delta.git',
:branch => 'all-ts-versions',
:ref => 'a38e7b104a'
Or Sidekiq (yes, the repo name is correct - the original ts-sidekiq-delta gem
was forked from ts-resque-delta):
gem 'ts-sidekiq-delta',
:git => 'git://github.com/pat/ts-resque-delta.git',
:branch => 'sidekiq',
:ref => '5bae80758c'
You can look at the index definitions in any of the following repos to see how
to set it up:
https://github.com/sphinxtamers/rails32_mri193_v4_dj_ts3
https://github.com/sphinxtamers/rails32_mri193_v4_resque_ts3
https://github.com/sphinxtamers/rails32_mri193_v4_sidekiq_ts3
> • What determines what triggers the delta to reindex? If associated
> records are updated does that trigger it? What about if the association
> contains columns that are attributes within the index? What if a record is
> touched (ie. only updated_at changes) but no other columns are changed?
Only updates that fire callbacks on the indexed model will fire off the delta
update. I've not played with the touch option much, but if that does fire
callbacks, then that'll get association updates prompting delta updates too.
> • Is there a way to trigger a delta-only index manually (ie. through
> rake, or something like that) so that it can be used via a cronjob? Is that a
> bad course of action to take?
Technically it's an option - though you'd probably want to write a new delta
adapter that doesn't actually fire off delta updates, just sets the delta flag
to true. Shouldn't be too difficult… though if you've got a background worker
(DJ/Resque/Sidekiq) already, I'd just use the appropriate gem instead.
> • Is there a way to merge the delta index into the main index without
> having to reindex the entire thing all over again?
Sphinx does have an index merging feature. The last time I gave it a spin I
didn't find it worked reliably - but that was a few years ago now.
http://sphinxsearch.com/docs/current.html#index-merging
There is also realtime indices, but that's a bit of a shift (and I'm still
considering it beta):
http://freelancing-gods.com/posts/rewriting_thinking_sphinx_introducing_realtime_indices
--
Pat
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.