As a newbie I’m having a rough time figuring this out. I have two ActiveRecord models: Contact which belongs to Account and account which has many contacts.
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
What I’m trying to do is to get an already scoped list of contact IDs from the algolia search so I won’t hit another account contact IDs (which would mess with the hits per page with pagination). The following query for example:
should only use the IDs from contacts where the account_id is the same than
current_account.id. I think it has something to do with facets but I’m not pretty sure.