#195 new

Adding multiple language support to DSL

Reported by greggersh | December 6th, 2011 @ 11:29 AM

I took a stab at adding language support to Sunspot (based on a comment from Nick Z. here: http://stackoverflow.com/questions/4508780/sorl-sunspot-determine-i.... I've added the ability to use :lang => "es" (or whatever identifier for language you deem appropriate) in the DSL to tell Sunspot which field/field type to use. When implementing this on a recent project I had to use :as and explicitly name the field, which wasn't too bad, but I thought it could be prettier.

So, instead of this:

text :title, :as => 'title_text_es

I can say:

text :title, :lang => "es"

Note that this implementation requires that either the default schema.xml be updated to include field types for each different language, or would require the user to modify schema.xml with field types they want to use.

I've pushed a fork to github (https://github.com/greggersh/sunspot/commit/9fb3485be1984d9bdfecfe3...) and am looking for feedback from anyone as to whether or not this is useful and what else might need to be done.

Hope this helps, let me know if there's more information I can provide.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Awesome Solr interaction for Ruby

People watching this ticket