diff --git a/Gemfile b/Gemfile index 518d07ab4..7e82924e1 100644 --- a/Gemfile +++ b/Gemfile @@ -67,6 +67,7 @@ gem "omniauth-twitter", "~> 1.4" # OmniAuth strategy for Twitter gem "parallel", "~> 1.20" # Run any kind of code in parallel processes gem "patron", "~> 0.13.3" # HTTP client library based on libcurl, used with Elasticsearch to support http keep-alive connections gem "pg", "~> 1.2" # Pg is the Ruby interface to the PostgreSQL RDBMS +gem "pg_search", "~> 2.3.5" # PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search gem "puma", "~> 5.2.2" # Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server gem "pundit", "~> 2.1" # Object oriented authorization for Rails applications gem "pusher", "~> 1.4" # Ruby library for Pusher Channels HTTP API diff --git a/Gemfile.lock b/Gemfile.lock index 00a7661df..7a9751504 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -525,6 +525,9 @@ GEM ast (~> 2.4.1) patron (0.13.3) pg (1.2.3) + pg_search (2.3.5) + activerecord (>= 5.2) + activesupport (>= 5.2) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) @@ -935,6 +938,7 @@ DEPENDENCIES parallel (~> 1.20) patron (~> 0.13.3) pg (~> 1.2) + pg_search (~> 2.3.5) pry (~> 0.13) pry-byebug (~> 3.8) pry-rails (~> 0.3) diff --git a/db/migrate/20210304195203_pg_search_extensions.rb b/db/migrate/20210304195203_pg_search_extensions.rb new file mode 100644 index 000000000..a85687c73 --- /dev/null +++ b/db/migrate/20210304195203_pg_search_extensions.rb @@ -0,0 +1,11 @@ +class PgSearchExtensions < ActiveRecord::Migration[6.0] + def up + enable_extension("unaccent") # For ignoring accent marks https://github.com/Casecommons/pg_search#ignoring-accent-marks + enable_extension("pg_trgm") # For trigram searches https://github.com/Casecommons/pg_search#trigram-trigram-search + end + + def down + disable_extension("unaccent") + disable_extension("pg_trgm") + end +end diff --git a/db/schema.rb b/db/schema.rb index 7e003b737..306ba5032 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,12 +10,14 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_02_19_043102) do +ActiveRecord::Schema.define(version: 2021_03_04_195203) do # These are extensions that must be enabled in order to support this database enable_extension "citext" + enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "plpgsql" + enable_extension "unaccent" create_table "ahoy_events", force: :cascade do |t| t.string "name" diff --git a/vendor/cache/pg_search-2.3.5.gem b/vendor/cache/pg_search-2.3.5.gem new file mode 100644 index 000000000..ec5696d3d Binary files /dev/null and b/vendor/cache/pg_search-2.3.5.gem differ