Reputation: 286
I am trying to create a TS scope as follows:
include ThinkingSphinx::Scopes
sphinx_scope(:status_approved) {
{:conditions => {:status => "approved"}}
}
default_sphinx_scope :status_approved
My indice file is:
indexes name, status
has user_id, created_at
Two questions:
I'm using Rails 3.2.16 and TS 3.0.6
Upvotes: 0
Views: 894
Reputation: 286
To answer my own questions after further research:
There is a 'new' feature introduced to TS called Realtime Indices which apparently addresses this issue. This was mentioned in the author's blog http://freelancing-gods.com/ I have not tried it. In any case, I have taken a different route which did away using the default scope and use the filtering in the indices instead. In my index file, i now have:
indexes name, status
has user_id, created_at
where "status = 'approved'"
And I no longer need to define the default scope in my model as such. This will still require periodic reindexing in any case.
Upvotes: 0
Reputation: 16226
Upvotes: 3