Setup pg_search (#12905)
* Add pg_search gem * Add pg_search extensions
This commit is contained in:
parent
a6ee6578ca
commit
619a058314
5 changed files with 19 additions and 1 deletions
1
Gemfile
1
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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
11
db/migrate/20210304195203_pg_search_extensions.rb
Normal file
11
db/migrate/20210304195203_pg_search_extensions.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
BIN
vendor/cache/pg_search-2.3.5.gem
vendored
Normal file
BIN
vendor/cache/pg_search-2.3.5.gem
vendored
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue