Sha256: 3a52807448aa3ba8c24c90e34b7da7160e61790103e0d3fbe51eaeb61dc81059

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

module Qa::Authorities
  class Mesh

    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

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

    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

    # satisfy TermsController
    def parse_authority_response
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qa-0.0.3 lib/qa/authorities/mesh.rb
qa-0.0.2 lib/qa/authorities/mesh.rb