Thanks Pat. This should help me.

On Sat, Jul 23, 2016 at 12:21 PM, Pat Allan <[email protected]>
wrote:

> Hi Sundar
>
> Sorry for being so slow on responding to this.
>
> Certainly, the code you’ve got there will not remove documents from the
> core index. What this means is that any queries that match old data in the
> core index will return results that you may not want. What you could do
> instead is the following:
>
>   ids = Article.where(<some_condition>).pluck :id
>
>   Article.where(:ids => ids).update_all :delta => true
>   ThinkingSphinx::Deltas::IndexJob.new(‘article_delta’).perform
>
>   indices =
> ThinkingSphinx::Configuration.instance.indices_for_references(:article)
>   indices.reject { |index| index.delta? }.each do |index|
>     ids.each do |id|
>       ThinkingSphinx::Deltas::DeleteJob.new(
>         index.name, index.document_id_for_key(id)
>       ).perform
>     end
>   end
>
> Note that this code should work with TS v3.0.4. A slightly simpler
> approach (which involves far fewer Sphinx queries) is available since
> v3.1.2:
>
>   ids = Article.where(<some_condition>).pluck :id
>
>   Article.where(:ids => ids).update_all :delta => true
>   ThinkingSphinx::Deltas::IndexJob.new(‘article_delta’).perform
>
>   indices =
> ThinkingSphinx::Configuration.instance.indices_for_references(:article)
>   indices.reject { |index| index.delta? }.each do |index|
>     ThinkingSphinx::Deletion.perform index, ids
>   end
>
> If you wanted to push this behaviour into Delayed Job instead, then I’d
> recommend creating a custom job class to do so (as the internals of
> ts-delayed-delta for deleting from the core index are written with single
> instances in mind).
>
> Hope this helps!
>
> —
> Pat
>
> On 5 Jul 2016, at 11:16 PM, Sundar Rajamanickam <
> [email protected]> wrote:
>
> Hi
>
> If I do the following, how will the documents be removed from core index (
> because we do not invoke ThinkingSphinx::Deltas::DeleteJob ) ? Is there an
> impact with not removing the documents from core index ?
>
> *Article.where(<some_condition>).**update_all("delta = 1")*
>
> *ThinkingSphinx::Deltas::IndexJob.new("article_delta").perform*
>
>
> Also, if I only want to en-queue jobs in DJ queue post update_all, what
> should be done ?
>
>
> *Gem versions:*
>
> gem 'thinking-sphinx', '3.0.4'
> gem 'ts-delayed-delta', '~> 2.0.2'
>
> --
> 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 https://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Thinking Sphinx" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/thinking-sphinx/8u3iS_wNfGA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
<http://www.chronus.com/>

Sundar Rajamanickam
Software Design Engineer, Chronus
+91 9566098418


<https://www.linkedin.com/company/chronussoftware>
<https://www.facebook.com/ChronusSoftware/>
<https://twitter.com/ChronusSoftware>

-- 
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 https://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.

Reply via email to