Gareth Fuller Gareth Fuller - 2 months ago 14
Ruby Question

Using advancedSyntax in Algolia Search

I have Algolia search installed and working in my rails app. I want to set the advancedSyntax option to true for my indexed model. This is what I've tried in the model:

algoliasearch if: :approved?, per_environment: true do
attribute :title, :location, :description, :posted_at, :id

attributesToIndex ['title', 'description', 'location']


attribute :posted_at_i do
posted_at.to_i
end

customRanking ['desc(posted_at_i)']

advancedSyntax true
end


And I get this error:

undefined method `advancedSyntax' for #<AlgoliaSearch::IndexSettings:0x0055955e3ca548>


I can't find advice that shows how to set this option in the rails model. Can it be done? and if so how?

Thanks in advance for any help provided.

Answer

This was a missing feature of the Rails integration. Here is the commit fixing it. It's part of the 1.15.1 version.