Oops, forgot to update this...after I'd had my caffeine fix i realised
this was a stoopid question, and checking the conf file confirmed that
the where condition was being used.

The problem still persisted and after a few hours of frustration I
discovered that ThinkingSphinx.pid_active? fails silently on Windows
and therefore the sphinx_deleted attribute wasn't being set on the
indexes.

A quick monkey-patch is here: http://pastie.org/409656

Although a better solution would be to rescue the NotImplementedError
raised by the Process.getpgid method... I'll put together a proper
patch when I get chance, assuming Pat doesn't beat me to it!

On Mar 6, 12:27 pm, rob-twf <[email protected]> wrote:
> Am I correct that delta indexes don't use the 'where' conditions of
> the main index?
>
> Here's an example, my model defines indexing like this:
>
> define_index do
>   indexes :content
>   has created_at
>   where 'deleted_at IS NULL'
>   set_property :delta => true
> end
>
> The deleted_at attribute is used for soft-deletion of the model.
>
> I have two records, both having content containing the word 'test' and
> both with deleted_at NULL.
> I run rake ts:in to build the index and then rake ts:start to get
> things going
> In a console I do MyModel.search 'test' and correctly receive two
> results
> I then update the deleted_at attribute of one of the records, setting
> it to Time.current and save
> The delta index is updated without error
> I do MyModel.search 'test' but it still returns two results
> Rebuilding the index with rake ts:in does remove the deleted record
> and then search returns the expected result
>
> I can obviously work around this using attributes and filters (or even
> toggle_deleted), but wanted to make sure I wasn't missing a more
> obvious solution first!
>
> Thanks,
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to