Sha256: 4a3bd926a72fa2f94433943c053c80c15ebda8abc0ca117adc9b36357efced31

Contents?: true

Size: 482 Bytes

Versions: 45

Compression:

Stored size: 482 Bytes

Contents

module Qa::Authorities
  class Mesh < Base
    def search(q)
      r = Qa::SubjectMeshTerm.where('term_lower LIKE ?', "#{q}%").limit(10)
      r.map { |t| { id: t.term_id, label: t.term } }
    end

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

    def all
      r = Qa::SubjectMeshTerm.all
      r.map { |t| { id: t.term_id, label: t.term } }
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
qa-5.14.0 lib/qa/authorities/mesh.rb
qa-5.13.0 lib/qa/authorities/mesh.rb
qa-5.12.0 lib/qa/authorities/mesh.rb
qa-5.11.0 lib/qa/authorities/mesh.rb
qa-5.10.0 lib/qa/authorities/mesh.rb
qa-5.9.0 lib/qa/authorities/mesh.rb
qa-5.8.1 lib/qa/authorities/mesh.rb
qa-5.8.0 lib/qa/authorities/mesh.rb
qa-5.7.0 lib/qa/authorities/mesh.rb
qa-5.6.0 lib/qa/authorities/mesh.rb
qa-5.5.2 lib/qa/authorities/mesh.rb
qa-4.3.0 lib/qa/authorities/mesh.rb
qa-3.1.0 lib/qa/authorities/mesh.rb
qa-2.3.0 lib/qa/authorities/mesh.rb
qa-5.5.1 lib/qa/authorities/mesh.rb
qa-5.5.0 lib/qa/authorities/mesh.rb
qa-5.4.0 lib/qa/authorities/mesh.rb
qa-5.3.1 lib/qa/authorities/mesh.rb
qa-5.3.0 lib/qa/authorities/mesh.rb
qa-5.2.0 lib/qa/authorities/mesh.rb