Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
include AlgoliaSearch
algoliasearch do
# all attributes will be sent
attributesForFaceting [:part_name]
add_attribute :part_name do
Part.find(part_id).name
end
customRanking ['asc(part_name)', 'asc(name)']
add_slave 'Equipment_cost_asc' do
attributesToIndex [:cost]
customRanking ['asc(cost)']
end
add_slave 'Equipment_cost_desc' do
attributesToIndex [:cost]
customRanking ['desc(cost)']
end
add_slave 'Equipment_weight_asc' do
attributesToIndex [:weight]
customRanking ['asc(weight)']
end
add_slave 'Equipment_weight_desc' do
attributesToIndex [:weight]
customRanking ['desc(weight)']
end
# add_attribute :thumbnail do
# if avatar
# avatar.path
# else
# 'none'
# end
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment