|
|
|
|
@ -72,46 +72,6 @@ class Cdao::Jurisprudence < Cdao::Base
|
|
|
|
|
subjects.map(&:id) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
searchable do |
|
|
|
|
text :reference_number, stored: true |
|
|
|
|
text :title, stored: true |
|
|
|
|
text :short_title, stored: true |
|
|
|
|
|
|
|
|
|
string :reference_number |
|
|
|
|
string :title do |
|
|
|
|
(title.present? ? title.first(32760).strip : short_title || "").titleize |
|
|
|
|
end |
|
|
|
|
string :short_title do |
|
|
|
|
(short_title.presence || title.first(32760).strip || "").titleize |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
date :doc_date |
|
|
|
|
date :search_doc_date do |
|
|
|
|
doc_date.presence || Date.new(year.presence || 0) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
integer :id |
|
|
|
|
integer :year |
|
|
|
|
integer :search_year do |
|
|
|
|
year.present? && year > 0 ? year : (doc_date.try :year) |
|
|
|
|
end |
|
|
|
|
integer :subject_ids, multiple: true |
|
|
|
|
|
|
|
|
|
boolean :edited |
|
|
|
|
|
|
|
|
|
join(:phil_rep, :target => Annotation, :type => :string, :join => { :from => :document_id, :to => :id }) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def phil_rep |
|
|
|
|
names = citation_finders_names.keep_if { |a| a.match?("Phil") } |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def scra |
|
|
|
|
names = citation_finders_names.keep_if { |a| a.match?(Cdao::CitationFinder::TYPES[0]) } |
|
|
|
|
|
|
|
|
|
names |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def citation_finders_names |
|
|
|
|
return [] if citation_finders.blank? |
|
|
|
|
|
|
|
|
|
@ -146,4 +106,47 @@ class Cdao::Jurisprudence < Cdao::Base
|
|
|
|
|
|
|
|
|
|
names |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def phil_rep |
|
|
|
|
return "" if citation_finders.blank? |
|
|
|
|
|
|
|
|
|
citation_finders.where(citation_source_id: 1).map(&:display_name).join(' | ') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def scra |
|
|
|
|
return "" if citation_finders.blank? |
|
|
|
|
|
|
|
|
|
citation_finders.where(citation_source_id: 0).map(&:display_name).join(' | ') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
searchable include: [:citation_finders] do |
|
|
|
|
text :reference_number, stored: true |
|
|
|
|
text :title, stored: true |
|
|
|
|
text :short_title, stored: true |
|
|
|
|
|
|
|
|
|
string :reference_number |
|
|
|
|
string :title do |
|
|
|
|
(title.present? ? title.first(32760).strip : short_title || "").titleize |
|
|
|
|
end |
|
|
|
|
string :short_title do |
|
|
|
|
(short_title.presence || title.first(32760).strip || "").titleize |
|
|
|
|
end |
|
|
|
|
string :citation_finders_names, multiple: true |
|
|
|
|
|
|
|
|
|
date :doc_date |
|
|
|
|
date :search_doc_date do |
|
|
|
|
doc_date.presence || Date.new(year.presence || 0) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
integer :id |
|
|
|
|
integer :year |
|
|
|
|
integer :search_year do |
|
|
|
|
year.present? && year > 0 ? year : (doc_date.try :year) |
|
|
|
|
end |
|
|
|
|
integer :subject_ids, multiple: true |
|
|
|
|
|
|
|
|
|
boolean :edited |
|
|
|
|
|
|
|
|
|
join(:phil_rep, :target => Annotation, :type => :string, :join => { :from => :document_id, :to => :id }) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|