Indexing with a method

I am using rails, I am indexing items from my item model.

The displayed name on my shop is a ‘built from data name’, I mean, the name contains, the weight or some other information related to the kind of item. This display is calculated by a method in my app.

How can I integrate that method (get_article_info) and the name to display (complete_name) in the indexation ?

I do have now in my model :

algoliasearch do
:complete_name == get_article_info
attribute :name, :published, :category, :complete_name
searchableAttributes [‘complete_name’]

I am able to index the item but can’t index the complete_name.

Can you please help me to create my indexation.

Thank you and regards

ok, I got it,
To add an attribute calculated from a method we just add it as a symbol with add_attribute

add_attribute :get_article_info

I am able to index that info.