Do not use Elasticsearch
This commit is contained in:
parent
1f14725583
commit
ebbc38cff9
10 changed files with 0 additions and 103 deletions
10
.travis.yml
10
.travis.yml
|
@ -34,11 +34,6 @@ env:
|
||||||
- RAILS_CACHE_REDIS_DB=1
|
- RAILS_CACHE_REDIS_DB=1
|
||||||
- RAILS_CACHE_REDIS_PASSWORD=
|
- RAILS_CACHE_REDIS_PASSWORD=
|
||||||
|
|
||||||
- ELASTICSEARCH_HOST=localhost
|
|
||||||
- ELASTICSEARCH_PORT=9200
|
|
||||||
- ELASTICSEARCH_USER=elastic
|
|
||||||
- ELASTICSEARCH_PASSWORD=changeme
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
|
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
|
||||||
- sudo tar -xvzf geckodriver*
|
- sudo tar -xvzf geckodriver*
|
||||||
|
@ -46,11 +41,6 @@ before_install:
|
||||||
- sudo mv geckodriver /usr/local/bin/
|
- sudo mv geckodriver /usr/local/bin/
|
||||||
- geckodriver --version
|
- geckodriver --version
|
||||||
|
|
||||||
- curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-amd64.deb
|
|
||||||
- sudo dpkg -i --force-confnew elasticsearch-7.5.1-amd64.deb
|
|
||||||
- sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
|
|
||||||
- sudo systemctl restart elasticsearch.service
|
|
||||||
|
|
||||||
install: script/setup
|
install: script/setup
|
||||||
|
|
||||||
script: bundle exec rake all
|
script: bundle exec rake all
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -12,8 +12,6 @@ gem 'bootsnap', '>= 1.4.0', require: false
|
||||||
gem 'bootstrap', '~> 4.3.1'
|
gem 'bootstrap', '~> 4.3.1'
|
||||||
gem 'devise', '~> 4.7'
|
gem 'devise', '~> 4.7'
|
||||||
gem 'devise-i18n', '~> 1.8'
|
gem 'devise-i18n', '~> 1.8'
|
||||||
gem 'elasticsearch-model', '~> 7.0'
|
|
||||||
gem 'elasticsearch-rails', '~> 7.0'
|
|
||||||
gem 'font-awesome-sass', '~> 5.5.0'
|
gem 'font-awesome-sass', '~> 5.5.0'
|
||||||
gem 'interactor', '~> 3.1'
|
gem 'interactor', '~> 3.1'
|
||||||
gem 'jquery-rails', '~> 4.3'
|
gem 'jquery-rails', '~> 4.3'
|
||||||
|
|
15
Gemfile.lock
15
Gemfile.lock
|
@ -178,19 +178,6 @@ GEM
|
||||||
docile (1.3.2)
|
docile (1.3.2)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
elasticsearch (7.4.0)
|
|
||||||
elasticsearch-api (= 7.4.0)
|
|
||||||
elasticsearch-transport (= 7.4.0)
|
|
||||||
elasticsearch-api (7.4.0)
|
|
||||||
multi_json
|
|
||||||
elasticsearch-model (7.0.0)
|
|
||||||
activesupport (> 3)
|
|
||||||
elasticsearch (> 1)
|
|
||||||
hashie
|
|
||||||
elasticsearch-rails (7.0.0)
|
|
||||||
elasticsearch-transport (7.4.0)
|
|
||||||
faraday
|
|
||||||
multi_json
|
|
||||||
erubi (1.9.0)
|
erubi (1.9.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
factory_bot (4.11.1)
|
factory_bot (4.11.1)
|
||||||
|
@ -504,8 +491,6 @@ DEPENDENCIES
|
||||||
database_cleaner (~> 1.7)
|
database_cleaner (~> 1.7)
|
||||||
devise (~> 4.7)
|
devise (~> 4.7)
|
||||||
devise-i18n (~> 1.8)
|
devise-i18n (~> 1.8)
|
||||||
elasticsearch-model (~> 7.0)
|
|
||||||
elasticsearch-rails (~> 7.0)
|
|
||||||
factory_bot_rails (~> 4.10)
|
factory_bot_rails (~> 4.10)
|
||||||
faker (~> 1.8)
|
faker (~> 1.8)
|
||||||
font-awesome-sass (~> 5.5.0)
|
font-awesome-sass (~> 5.5.0)
|
||||||
|
|
|
@ -1,16 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
include Searchable
|
|
||||||
|
|
||||||
settings index: { number_of_shards: 1 } do
|
|
||||||
mapping dynamic: false do
|
|
||||||
indexes :nickname, analyzer: 'english'
|
|
||||||
indexes :public_name, analyzer: 'russian'
|
|
||||||
indexes :biography, analyzer: 'russian'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# Associations #
|
# Associations #
|
||||||
################
|
################
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Searchable
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
included do
|
|
||||||
include Elasticsearch::Model
|
|
||||||
include Elasticsearch::Model::Callbacks
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -2,19 +2,9 @@
|
||||||
|
|
||||||
class Person < ApplicationRecord
|
class Person < ApplicationRecord
|
||||||
include Nameable
|
include Nameable
|
||||||
include Searchable
|
|
||||||
|
|
||||||
ACCOUNT_CONNECTION_TOKEN_RE = /\A\w+\z/.freeze
|
ACCOUNT_CONNECTION_TOKEN_RE = /\A\w+\z/.freeze
|
||||||
|
|
||||||
settings index: { number_of_shards: 1 } do
|
|
||||||
mapping dynamic: false do
|
|
||||||
indexes :first_name, analyzer: 'russian'
|
|
||||||
indexes :middle_name, analyzer: 'russian'
|
|
||||||
indexes :last_name, analyzer: 'russian'
|
|
||||||
indexes :place_of_birth, analyzer: 'russian'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# Associations #
|
# Associations #
|
||||||
################
|
################
|
||||||
|
|
|
@ -17,8 +17,6 @@ require 'sprockets/railtie'
|
||||||
# you've limited to :test, :development, :staging, or :production.
|
# you've limited to :test, :development, :staging, or :production.
|
||||||
Bundler.require(*Rails.groups)
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
require 'elasticsearch/rails/instrumentation'
|
|
||||||
|
|
||||||
require 'csv'
|
require 'csv'
|
||||||
|
|
||||||
module Partynest
|
module Partynest
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
conf = Rails.application.settings :elasticsearch
|
|
||||||
|
|
||||||
Elasticsearch::Model.client = Elasticsearch::Client.new(
|
|
||||||
scheme: conf[:ssl] ? :https : :http,
|
|
||||||
host: String(conf[:host]),
|
|
||||||
port: Integer(conf[:port]),
|
|
||||||
user: String(conf[:user]),
|
|
||||||
password: String(conf[:password]),
|
|
||||||
|
|
||||||
transport_options: {
|
|
||||||
request: { timeout: 5 },
|
|
||||||
ssl: { ca_file: conf.dig(:ssl_params, :ca_file) },
|
|
||||||
},
|
|
||||||
)
|
|
|
@ -1,20 +0,0 @@
|
||||||
default: &default
|
|
||||||
host: <%= ENV.fetch('ELASTICSEARCH_HOST') { 'localhost' } %>
|
|
||||||
port: <%= ENV.fetch('ELASTICSEARCH_PORT') { 9200 } %>
|
|
||||||
user: <%= ENV.fetch('ELASTICSEARCH_USER') { 'elastic' } %>
|
|
||||||
password: <%= ENV.fetch('ELASTICSEARCH_PASSWORD') { 'changeme' } %>
|
|
||||||
ssl: false
|
|
||||||
ssl_params:
|
|
||||||
ca_file: null
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
||||||
|
|
||||||
staging:
|
|
||||||
<<: *default
|
|
||||||
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
|
@ -1,6 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'elasticsearch/rails/tasks/import'
|
|
||||||
|
|
||||||
Rake::Task['elasticsearch:import:all'].prerequisites << :environment
|
|
||||||
Rake::Task['elasticsearch:import:model'].prerequisites << :environment
|
|
Reference in a new issue