|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
class SubjectSearchService < ApplicationService
|
|
|
|
|
include ElasticsearchAble
|
|
|
|
|
|
|
|
|
|
attr_reader :params, :subdomain
|
|
|
|
|
attr_reader :params, :laboratory
|
|
|
|
|
|
|
|
|
|
def initialize(params, subdomain)
|
|
|
|
|
def initialize(params, laboratory)
|
|
|
|
|
@params = params
|
|
|
|
|
@subdomain = subdomain
|
|
|
|
|
@laboratory = laboratory
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def call
|
|
|
|
@ -22,8 +22,8 @@ class SubjectSearchService < ApplicationService
|
|
|
|
|
# @subjects = @subjects.where(id: laboratory.subjects) if laboratory
|
|
|
|
|
|
|
|
|
|
## 云上实验室过滤
|
|
|
|
|
unless current_laboratory.main_site?
|
|
|
|
|
subjects = subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
|
|
|
|
|
unless laboratory.main_site?
|
|
|
|
|
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: laboratory.id })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Subject.search(keyword, search_options)
|
|
|
|
|