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:
- Does field status needs to be defined as an index in order for the conditions string filter to work? Seems like I get a no field in schema query error if I do not do that.
- If it is required to define as part of the indexes, then whenever someone updated the status field, it will not show in the results until the next reindex occurs. Is this the only way to use a string filtering TS scope? Or is there a better way to do this?
I'm using Rails 3.2.16 and TS 3.0.6