1
0
Fork 0

Do not use Elasticsearch

This commit is contained in:
Alex Kotov 2020-02-15 04:10:33 +05:00
parent 1f14725583
commit ebbc38cff9
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
10 changed files with 0 additions and 103 deletions

View File

@ -34,11 +34,6 @@ env:
- RAILS_CACHE_REDIS_DB=1
- RAILS_CACHE_REDIS_PASSWORD=
- ELASTICSEARCH_HOST=localhost
- ELASTICSEARCH_PORT=9200
- ELASTICSEARCH_USER=elastic
- ELASTICSEARCH_PASSWORD=changeme
before_install:
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
- sudo tar -xvzf geckodriver*
@ -46,11 +41,6 @@ before_install:
- sudo mv geckodriver /usr/local/bin/
- 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
script: bundle exec rake all

View File

@ -12,8 +12,6 @@ gem 'bootsnap', '>= 1.4.0', require: false
gem 'bootstrap', '~> 4.3.1'
gem 'devise', '~> 4.7'
gem 'devise-i18n', '~> 1.8'
gem 'elasticsearch-model', '~> 7.0'
gem 'elasticsearch-rails', '~> 7.0'
gem 'font-awesome-sass', '~> 5.5.0'
gem 'interactor', '~> 3.1'
gem 'jquery-rails', '~> 4.3'

View File

@ -178,19 +178,6 @@ GEM
docile (1.3.2)
domain_name (0.5.20190701)
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)
execjs (2.7.0)
factory_bot (4.11.1)
@ -504,8 +491,6 @@ DEPENDENCIES
database_cleaner (~> 1.7)
devise (~> 4.7)
devise-i18n (~> 1.8)
elasticsearch-model (~> 7.0)
elasticsearch-rails (~> 7.0)
factory_bot_rails (~> 4.10)
faker (~> 1.8)
font-awesome-sass (~> 5.5.0)

View File

@ -1,16 +1,6 @@
# frozen_string_literal: true
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 #
################

View File

@ -1,10 +0,0 @@
# frozen_string_literal: true
module Searchable
extend ActiveSupport::Concern
included do
include Elasticsearch::Model
include Elasticsearch::Model::Callbacks
end
end

View File

@ -2,19 +2,9 @@
class Person < ApplicationRecord
include Nameable
include Searchable
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 #
################

View File

@ -17,8 +17,6 @@ require 'sprockets/railtie'
# you've limited to :test, :development, :staging, or :production.
Bundler.require(*Rails.groups)
require 'elasticsearch/rails/instrumentation'
require 'csv'
module Partynest

View File

@ -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) },
},
)

View 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

View File

@ -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