2

I am struggling with a Tire issue.

In my Model, I added in the mapping:

indexes :localized_title, :as => "localized_title" and the function that returns the hash of translations

def localized_title
  hash = {}
  translations.each do |t|
    hash[t.locale] = t.title
   end
  hash
end

When I create a record of this model, even though the record is created in the database, it is not indexed

>Model.search{query{all}}.total
=> 0

But, if I update the index manually, it is indexed.

>Model.last.update_index
>Model.search{query{all}}.total 
=> 1

An after_save update_index does not help. Any ideas ?

I would like the record to be automatically indexed, how can I do it ?

1 Answer 1

2

You should set the type of 'object' in the mapping of your localized_title, as it's a hash.

You can use

indexes :localized_title, :as => "localized_title", :type => :object
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.