Since I have a model with localized fields (using Globalize, I'd like to make localized search. I set up two indices on my model :
ThinkingSphinx::Index.define :document, name: "document_fr", :with => :active_record, :delta => true do
indexes translations.name, :as => :options
indexes translations.description
where "(#{Document.translations_table_name}.locale='fr' OR #{Document.translations_table_name}.locale IS NULL)"
has created_at, updated_at
end
ThinkingSphinx::Index.define :document, name: "document_nl", :with => :active_record, :delta => true do
indexes translations.name, :as => :options
indexes translations.description
where "(#{Document.translations_table_name}.locale='nl' OR #{Document.translations_table_name}.locale IS NULL)"
has created_at, updated_at
end
How can I make a search on one index, using the delta ?
I tried to use the indices
options but it does not really work :
Document.search 'something', {
indices: ["document_fr_core", "document_fr_delta"]
}
=> If I change a Document instance and save it, delta indexing happens and the change are indexed in *_delta. But since I am also searching on *_core, the modified instance is still found even when the has no match for the search anymore :-(
Edit (24/04/2015) Alternative solution may be to use facets search for the translations. But I am not really sure how to use them. If you think it's a better solution, please let me know :-)