Skip to content

Instantly share code, notes, and snippets.

@thomasdavis
Created July 5, 2015 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdavis/f7f314e3f09824c767a0 to your computer and use it in GitHub Desktop.
Save thomasdavis/f7f314e3f09824c767a0 to your computer and use it in GitHub Desktop.
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