|
|
|
|
@ -35,9 +35,17 @@ class Annotation < ApplicationRecord
|
|
|
|
|
integer :document_id |
|
|
|
|
integer :doctrine_id |
|
|
|
|
|
|
|
|
|
join(:library_rank, target: Cdao::Document, type: :integer, join: { from: :id, to: :document_id }) |
|
|
|
|
join(:search_year, target: Cdao::Document, type: :integer, join: { from: :id, to: :document_id }) |
|
|
|
|
join(:search_doc_date, target: Cdao::Document, type: :date, join: { from: :id, to: :document_id }) |
|
|
|
|
integer :library_rank do |
|
|
|
|
document.library.rank |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
integer :search_year do |
|
|
|
|
document.year.present? && document.year > 0 ? document.year : (document.doc_date.try :year) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
date :search_doc_date do |
|
|
|
|
document.doc_date.presence || Date.new(year.presence || 0) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
date :created_at |
|
|
|
|
date :updated_at |
|
|
|
|
|