How can I use https://github.com/ankane/searchkick to search both Users
and Skills
and return users with skills searched for. Most relevant result should reflect how many of the skills
the User
has.
My Models look like this:
class User < ApplicationRecord
searchkick
has_many :user_skills
has_many :skills, through: :user_skills
end
class Skill < ApplicationRecord
searchkick
has_many :user_skills
has_many :users, through: :user_skills
end
class UserSkill < ApplicationRecord
searchkick
belongs_to :user
belongs_to :skill
end
I have tried the following, but no result are returned:
@search = User.search "*", where: {
skill_ids: {all: [1, 3]}
}