Class: Qa::Authorities::Mesh

Inherits:
Object
  • Object
show all
Defined in:
lib/qa/authorities/mesh.rb

Instance Method Summary collapse

Instance Method Details

#get_full_record(id) ⇒ Object



15
16
17
18
19
20
# File 'lib/qa/authorities/mesh.rb', line 15

def get_full_record(id)
  @results ||= begin
                 r = Qa::SubjectMeshTerm.where(term_id: id).limit(1).first
                 r.nil? ? nil : {id: r.term_id, label: r.term, synonyms: r.synonyms}
               end
end

#parse_authority_responseObject

satisfy TermsController



23
24
# File 'lib/qa/authorities/mesh.rb', line 23

def parse_authority_response
end

#resultsObject



4
5
6
7
8
9
# File 'lib/qa/authorities/mesh.rb', line 4

def results
  @results ||= begin
                 r = Qa::SubjectMeshTerm.where('term_lower LIKE ?', "#{@q}%").limit(10)
                 r.map { |t| {id: t.term_id, label: t.term} }
               end
end

#search(q, sub_authority = nil) ⇒ Object



11
12
13
# File 'lib/qa/authorities/mesh.rb', line 11

def search(q, sub_authority=nil)
  @q = q
end