Im trying to use Searchkick to run a search and return based on multiple models.
My book model contains this
class Book < ActiveRecord::Base
searchkick
has_many :book_subjects
has_many :subjects, through: :book_subjects
belongs_to :author
belongs_to :publisher
end
and then my controller has this
def index
if params[:search].present?
@books = Book.search(params[:search], operator: "or")
else
@books = Book.all
end
end
I want the search results to search the associated models and return any results there too -- so the boo subject name, the author and the publisher.
thanks