Sphinx Thinking: Multiple Indices and Delta
Since I have a model with localized fields (using Globalize I would like to do a localized search. I have set two metrics 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 search on a single index using delta?
I tried using options indices
, but that doesn't really work:
Document.search 'something', {
indices: ["document_fr_core", "document_fr_delta"]
}
=> If I change the document instance and save it, delta indexing happens and the change is indexed in * _delta. But since I also go through * _core, the modified instance is still found, even if it is no longer searchable: --(
Edit (24/04/2015) An alternative solution could be to use facets to find translations. But I'm not sure how to use them. If you think this is the best solution, please let me know :-)
source to share
No one has answered this question yet
Check out similar questions: