* Add table for multisearch * Add new route for searching all entities * Make models multisearchable We're going to start with Character, Summon, Weapon and Jobs * Add method to Search controller This will search with trigram first, and then if there aren't enough results, search with prefixed text search * Add support for Japanese all-entity search
31 lines
714 B
Ruby
31 lines
714 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Job < ApplicationRecord
|
|
include PgSearch::Model
|
|
|
|
belongs_to :party
|
|
has_many :skills, class_name: 'JobSkill'
|
|
|
|
multisearchable against: %i[name_en name_jp],
|
|
additional_attributes: lambda { |job|
|
|
{
|
|
name_en: job.name_en,
|
|
name_jp: job.name_jp,
|
|
granblue_id: job.granblue_id,
|
|
element: 0
|
|
}
|
|
}
|
|
|
|
belongs_to :base_job,
|
|
foreign_key: 'base_job_id',
|
|
class_name: 'Job',
|
|
optional: true
|
|
|
|
def blueprint
|
|
JobBlueprint
|
|
end
|
|
|
|
def display_resource(job)
|
|
job.name_en
|
|
end
|
|
end
|