Let's assume that we have a table users
.
CREATE TABLE users
(
id INT,
guest BOOL,
name VARCHAR(255)
)
I would like to index using Thinking Sphinx only records with guest equal to false
.
At this moment I have:
ThinkingSphinx::Index.define :user, with: :active_record do
indexes :name
end
Thanks.
Index definitions have a where
method to apply conditions to the generated SQL for indices:
ThinkingSphinx::Index.define :user, with: :active_record do
indexes name
where "users.guest = FALSE"
end