I'm not sure if I'm going in the right direction with the algolia-rails
gem (and Algolia in general):
Currently I have these two models:
class Contact < ActiveRecord::Base
include AlgoliaSearch
belongs_to :account
algoliasearch do
attribute :account_id, :full_name, :email, :tax_id, :contact_name
searchableAttributes ['full_name', 'email', 'tax_id', 'contact_name']
customRanking ['asc(full_name)']
end
end
class Account < ActiveRecord::Base
has_many :contacts
end
I would like to retrieve only matching records for a given account_id
on the contacts indexes so the resulting query won't look for contact IDs that don't belong to an specific account. So current_account.contacts.algolia_search("Tom")
should not fetch IDs from other accounts contacts.
Looks like it has something to do with facets but I'm not sure.