Globalize2 and Thinking Sphinx

Posted by anup.narkhede on August 17, 2010

If you are trying to integrate Thinking Sphinx with models using Globalize2 for translations, here is what worked for me. Many thanks to Zach Inglis and Pat Allan for their help.

My Article class uses Globalize2 to translate ‘title’ attribute in two locales (:en and :fr). Globalize2 creates an association named ‘translations’ for the table article_translations.

The solution is to set up one index per locale. As you see, ‘article_en’ automatically creates ‘article_en_core’ and ‘article_en_delta’ index if you use delta indexing.

To limit your search within a particular locale, pass on the :index option.
For ex:

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Charles Forcey Sun, 26 Sep 2010 03:28:40 PDT

    Thanks for commenting on globalize2 and Sphinx. Just what I needed! Cheers! C

  2. Patrick Mon, 17 Jan 2011 22:04:09 PST

    Thanks for sharing this! I’ve been wondering on how to search a specific locale for a while already!

  3. Michael Thu, 17 Mar 2011 05:40:23 PDT

    Thanks! This is still actual for globalize3 and rails3. Helped alot!

Comments