meshcomplete 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,8 @@ class Synonym < ActiveRecord::Base
2
2
  belongs_to :subject
3
3
 
4
4
  def self.search(starts_with, limit = 10)
5
- mesh = where(["term LIKE ?", "#{starts_with}%"]).limit(limit).order("term asc").includes(:subject).group_by(&:subject)
5
+ match_keyword = ::ActiveRecord::Base.connection.adapter_name == "PostgreSQL" ? "ILIKE" : "LIKE"
6
+ mesh = where(["term #{match_keyword} ?", "#{starts_with}%"]).limit(limit).order("term asc").includes(:subject).group_by(&:subject)
6
7
  mesh.keys.compact.sort_by(&:term).map {|m| {"id" => m.id, "label" => m.term, "value" => m.term, "entries" => mesh[m].reject {|e| m.term == e.term}.map{|e| e.term}.sort}}
7
8
  end
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module Meshcomplete
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: meshcomplete
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joon Lee