A deletion callback is added to models with real-time indices by default. I'm 
pretty sure they won't fire though if you use delete_all, so it's better to 
stick to destroy_all instead.

On 17/10/2013, at 5:54 PM, Mauro Nidola <[email protected]> wrote:

> Hi Pat, sorry to bother you again, but I have another question.
> I occasionally get the following exception:
> ThinkingSphinx::Search::StaleIdsException - Record IDs found by Sphinx but 
> not by ActiveRecord
> 
> I have a table indexed by TS using real_time indices.
> This table aggregates data coming from different sources. In certain 
> situations I need to delete certain entries (example: delete all notices) and 
> add new ones (example: add available notices).
> Do I need to set an after_destroy callback (same used for after_save) on the 
> model?
> Is it safe to use delete_all? Is it better to use destroy_all?
> 
> Many thanks,
> Mauro
> 
> On Wednesday, October 16, 2013 2:53:23 PM UTC+2, Pat Allan wrote:
> Yup, that should do the trick. But it's like db:migrate - only run it when 
> you need to.
> 
> On 16/10/2013, at 11:50 PM, Mauro Nidola <[email protected]> wrote:
> 
>> You are right.
>> 
>> Concerning deploy to production server:
>> TS 3.0.5 does not provide a capistrano recipe when using real time indices. 
>> Is executing the command "RAILS_ENV=production bundle exec rails 
>> ts:regenerate" all I need to do?
>> 
>> Many thanks for your help.
>> 
>> Mauro
>> 
>> 
>> 
>> On Wednesday, October 16, 2013 2:26:42 PM UTC+2, Pat Allan wrote:
>> It's all in the Sphinx documentation :)
>> 
>> http://sphinxsearch.com/docs/manual-2.0.9.html#rt-internals
>> 
>> When the daemon stops, yes, everything gets saved to the index files. If the 
>> daemon crashes, the next time it starts it will use the binlog files to 
>> ensure the indices are up to date. Perhaps it wouldn't be a bad idea to run 
>> ts:generate on a regular basis (but ts:regenerate only needs to be run when 
>> you change your index definitions or other Sphinx settings).
>> 
>> As for how frequently the updates are written to the file - see if the 
>> Sphinx documentation link above helps to clarify that (it's not a clear cut 
>> answer).
>> 
>> Good to know it's working for you!
>> 
>> -- 
>> Pat
>> 
>> On 16/10/2013, at 11:22 PM, Mauro Nidola <[email protected]> wrote:
>> 
>>> Hi Pat,
>>> it seems to work now, on monday I did several tests and perhaps I searched 
>>> on an empty table.
>>> 
>>> Can you confirm that indices are save to file when the sphinx deamon is 
>>> stopped?
>>> 
>>> Scenario:
>>> 
>>> 
>>> I execute the command bundle exec rake ts:regenerate and after that the 
>>> directory db/sphinx/development is empty (does indices lives to ram?)
>>> I stop the sphinx daemon executing the command bundle exec rake ts:stop and 
>>> after that indices are stored to file
>>> What happen if the sphinx process crashes? 
>>> 
>>> How frequently Are indices saved to file (every X amount of time OR only 
>>> when the sphinx process is stopped)?
>>> 
>>> It could be useful to include such information in the documentation ;)
>>> 
>>> Many thanks,
>>> Mauro
>>> 
>>> 
>>> On Wednesday, October 16, 2013 10:04:17 AM UTC+2, Pat Allan wrote:
>>> Hi Mauro 
>>> 
>>> Can you confirm the Sphinx daemon running is the one you expect? 
>>> 
>>>   ps aux | grep searchd 
>>> 
>>> Although, if it was a different daemon, surely there'd be some errors 
>>> somewhere along the way. 
>>> 
>>> And the paths in the generated development.sphinx.conf file point to 
>>> db/sphinx/development, right? Can't see any reason why they wouldn't. 
>>> 
>>> -- 
>>> Pat 
>>> 
>>> On 16/10/2013, at 5:23 PM, Mauro Nidola <[email protected]> wrote: 
>>> 
>>> > Hi Pat, 
>>> > follows the content of my config/thinking_sphinx.yml: 
>>> > 
>>> > development: 
>>> >   bin_path: "/usr/local/Cellar/sphinx/2.0.9/bin" 
>>> >   mysql41: 9306 
>>> >   enable_star: true 
>>> >   min_prefix_len: 3 
>>> >   html_strip: true 
>>> > test: 
>>> >   bin_path: "/usr/local/Cellar/sphinx/2.0.9/bin" 
>>> >   mysql41: 9307 
>>> >   enable_star: true 
>>> >   min_prefix_len: 3 
>>> >   html_strip: true 
>>> > 
>>> > 
>>> > I unsuccessfully tried with the last commit 2 days ago. 
>>> > 
>>> > Thanks, 
>>> > Mauro 
>>> > 
>>> > 
>>> > On Wednesday, October 16, 2013 2:39:25 AM UTC+2, Pat Allan wrote: 
>>> > There are people using it in production, and I've had it working locally, 
>>> > so I guess it's working through 'beta' status. 
>>> > 
>>> > Can you give the latest commits in TS a go, see if that helps at all? 
>>> > Also: do you have anything in your config/thinking_sphinx.yml file (if 
>>> > there is one)? 
>>> > 
>>> >   gem 'thinking-sphinx', 
>>> >     :git    => 'git://github.com/pat/thinking-sphinx.git', 
>>> >     :branch => 'master', 
>>> > 
>>> > -- 
>>> > Pat 
>>> > 
>>> > On 16/10/2013, at 3:08 AM, Mauro Nidola <[email protected]> wrote: 
>>> > 
>>> > > Hi Pat, 
>>> > > db/sphinx/development directory is empty and the same is for results. 
>>> > > 
>>> > > How can I debug this? 
>>> > > 
>>> > > Btw is real time indexing still in beta? 
>>> > > 
>>> > > Many thanks, Mauro 
>>> > > 
>>> > > On Tuesday, October 15, 2013 1:52:03 AM UTC+2, Pat Allan wrote: 
>>> > > Hi Mauro 
>>> > > 
>>> > > The output indicates it's running successfully… is there nothing at all 
>>> > > in db/sphinx/development? What about if you search for SearchableItem 
>>> > > objects? 
>>> > > 
>>> > > -- 
>>> > > Pat 
>>> > > 
>>> > > On 15/10/2013, at 2:00 AM, Mauro Nidola <[email protected]> wrote: 
>>> > > 
>>> > >> Hi Pat, I everybody, 
>>> > >> I read your blog post about realtime indexes, but I have a problem, 
>>> > >> indices are not generated when I run the command ts:regenerate (the 
>>> > >> directory /PATH/TO/RAILS/PROJECT/DIR/db/sphinx/development is empty). 
>>> > >> 
>>> > >> 
>>> > >> Follows the output of the command: 
>>> > >> 
>>> > >> searchd is not currently running. 
>>> > >> Stopped searchd daemon (pid: 2675). 
>>> > >> Generating configuration to 
>>> > >> /PATH/TO/RAILS/PROJECT/DIR/config/development.sphinx.conf 
>>> > >> Started searchd successfully (pid: 1279). 
>>> > >> Generating index files for searchable_item_core 
>>> > >> ............................. 
>>> > >> 
>>> > >> Env details: OSX 10.8.5, apache2 + passenger 4.0.20, ruby 1.9.2, rails 
>>> > >> 3.2.14 
>>> > >> 
>>> > >> Any idea? 
>>> > >> 
>>> > >> Many thanks in advance. 
>>> > >> 
>>> > >> -- 
>>> > >> 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. 
>>> > > 
>>> > > 
>>> > > -- 
>>> > > 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. 
>>> > 
>>> > 
>>> > -- 
>>> > 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. 
>>> 
>>> 
>>> -- 
>>> 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.
>> 
>> 
>> -- 
>> 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.
> 
> 
> -- 
> 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.

-- 
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.

Reply via email to