Hello.
I'm using globalize3 <https://github.com/svenfuchs/globalize3> gem to store
translations for Rails models in multilingual application. Shortly,
globalize3 gem uses an additional table for each model to store
translations for attributes, and in Rails it hooks model attribute getter
calls, transparently queries that table and return values for current
locales. Also it adds translations association for those, who need manual
control.
I want make sphinx to index all translations for every record with a
locale, and on search I want to restrict search only for the current locale
with ability of showing something like "View results in other languages".
One more thing that I wish to do (if possible) — to use different stemmers
for searching in different locales.
And worst thing — I don't know how it ever could look like in
configuration, as I'm newbie in Thinking sphinx, Sphinx and such a software
in general.
Currently, I've tried such a configuration.
ThinkingSphinx::Index.define :section, :with => :active_record do
indexes translations.title, as: :title, sortable: true
indexes translations.content, as: :content
#has translations.locale, as: :locale, type: :string # Throws an
error, requires integer field, but it's a string
end
And on searching I want to use something like:
Section.search params[:q], with: { locale: I18n.locale }
But sphinx indexes only first translation for record (first returned by
mysql, not all).
P.S> On stackoverflow, there is proposed solution with a metaprogramming
usage (for ElasticSearch), but I dislike it (what I've 10 languages?):
http://stackoverflow.com/questions/9951348/i18n-search-using-tire-and-globalize3
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.