pat / ts-delayed-delta

Manage delta indexes via Delayed Job for Thinking Sphinx
http://ts.freelancing-gods.com
MIT License
73 stars 33 forks source link

Delta flag not resetting #47

Closed bistline closed 6 years ago

bistline commented 10 years ago

I'm having a strange issue. I'm using ts-delayed-delta 2.0.2 and thinking-sphinx 3.1.1 with activerecord and delayed_job, and as far as I can tell the delta indices are being processed and returning correct results, but for some reason the delta boolean flag on my indexed model is staying set to true rather than resetting to false after the delta is processed.

Here's my index:

ThinkingSphinx::Index.define :page, :with => :active_record, :delta => ThinkingSphinx::Deltas::DelayedDelta do

indexes :title, as: :page_title
indexes :menu_cat, as: :page_menu_cat
indexes :menu_title, as: :page_menu_title
indexes :site_cat, as: :page_site_cat
indexes :sub_cat, as: :page_sub_cat
indexes :page_url, as: :page_page_url
indexes :content, as: :page_content
indexes :updated_by, as: :page_updated_by

has :id, as: :page_id
has :updated_at, :created_at

set_property :enable_star => 1
set_property :min_infix_len => 3

end

Here's the output of delayed_job.log after making a small edit to a page:

2014-08-21T11:20:34-0400: [Worker(delayed_job host:gm157-bec.broadinstitute.org pid:91282)] Job Thinking Sphinx: Process page_delta (id=17) RUNNING 2014-08-21T11:20:34-0400: [Worker(delayed_job host:gm157-bec.broadinstitute.org pid:91282)] Job Thinking Sphinx: Process page_delta (id=17) COMPLETED after 0.0635 2014-08-21T11:20:34-0400: [Worker(delayed_job host:gm157-bec.broadinstitute.org pid:91282)] Job Thinking Sphinx: Mark 26 in page_core as deleted (id=18) RUNNING 2014-08-21T11:20:34-0400: [Worker(delayed_job host:gm157-bec.broadinstitute.org pid:91282)] Job Thinking Sphinx: Mark 26 in page_core as deleted (id=18) COMPLETED after 0.0366 2014-08-21T11:20:34-0400: [Worker(delayed_job host:gm157-bec.broadinstitute.org pid:91282)] 2 jobs processed at 7.8692 j/s, 0 failed

And development.searchd.log:

[Thu Aug 21 11:20:34.359 2014] [91272] caught SIGHUP (seamless=1, in queue=1) [Thu Aug 21 11:20:34.396 2014] [91272] rotating index 'page_delta': started [Thu Aug 21 11:20:34.405 2014] [91272] rotating index 'page_delta': success [Thu Aug 21 11:20:34.405 2014] [91272] rotating index: all indexes done

This behavior is being replicated across all applications I'm running with TS and ts-delayed-delta right now. It worked fine on TS2 but since the upgrade to TS3 I've had this issue. Any thoughts?

pat commented 10 years ago

This is actually the appropriate behaviour - the delta flag stays set to true until the next full index. Otherwise, you'd have records appear in the delta index when they're changed, and then they'd be removed when a different record changes.

This was how things behaved with TS v2 as well - so I'm not sure how it behaved otherwise before you upgraded.