Skip to content
Snippets Groups Projects
Commit d550409d authored by Gustavo S Frehse's avatar Gustavo S Frehse
Browse files

ISSUE #42: UPDATE Elasticsearch gem and mappings

parent 56061825
No related branches found
No related tags found
1 merge request!39ISSUE #42: UPDATE Elasticsearch gem and mappings
Pipeline #33867 failed
...@@ -179,6 +179,6 @@ gem 'acts_as_list' ...@@ -179,6 +179,6 @@ gem 'acts_as_list'
gem 'faraday-net_http_persistent', '~> 2.0' gem 'faraday-net_http_persistent', '~> 2.0'
gem 'elasticsearch', '< 7.14' gem 'elasticsearch', '~> 8.6'
...@@ -74,11 +74,9 @@ class Collection < ApplicationRecord ...@@ -74,11 +74,9 @@ class Collection < ApplicationRecord
scope :from_user, ->(user) { where(owner: user) } scope :from_user, ->(user) { where(owner: user) }
searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true, mappings: { searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true, mappings: {
collection: { "properties": {
properties: { "created_at": {
created_at: { "type": "date"
type: "date"
}
} }
} }
} }
......
...@@ -99,8 +99,13 @@ class LearningObject < ApplicationRecord ...@@ -99,8 +99,13 @@ class LearningObject < ApplicationRecord
default_scope { includes(:object_type, :attachment, :attachments) } default_scope { includes(:object_type, :attachment, :attachments) }
scope :missing_thumbnail, ->() { where(thumbnail_file_name: nil) } scope :missing_thumbnail, ->() { where(thumbnail_file_name: nil) }
searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type, :tags, :subjects, :educational_stages, :languages], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type, :tags, :subjects, :educational_stages, :languages], callbacks: :async, index_prefix: Socket.gethostname.downcase, merge_mappings: true, mappings: {
{"mappings": {"_doc": {"properties": {"published_at": { "type": "date" }}}}} "properties": {
"published_at": {
"type": "date"
}
}
}
acts_as_paranoid acts_as_paranoid
scope :search_import, -> { includes(:object_type, :tags, :subjects, :educational_stages, :publisher) } scope :search_import, -> { includes(:object_type, :tags, :subjects, :educational_stages, :publisher) }
......
...@@ -35,11 +35,11 @@ export PORTALMEC_DSPACE_PORT=8443 ...@@ -35,11 +35,11 @@ export PORTALMEC_DSPACE_PORT=8443
export PORTALMEC_DSPACE_HOST=mecdb4.c3sl.ufpr.br export PORTALMEC_DSPACE_HOST=mecdb4.c3sl.ufpr.br
### Elasticsearch credentials ### Elasticsearch credentials
export PORTALMEC_ELASTICSEARCH_LOGIN=portalmec export PORTALMEC_ELASTICSEARCH_LOGIN=elastic
export PORTALMEC_ELASTICSEARCH_PASSWORD=elasticsearch export PORTALMEC_ELASTICSEARCH_PASSWORD=123mudar
export PORTALMEC_ELASTICSEARCH_PORT=9200 export PORTALMEC_ELASTICSEARCH_PORT=9200
#export PORTALMEC_ELASTICSEARCH_HOST=localhost export PORTALMEC_ELASTICSEARCH_HOST=localhost
export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchprod #export PORTALMEC_ELASTICSEARCH_HOST=elasticsearchprod
### Cache ### Cache
export MEMCACHE_SERVERS=localhost export MEMCACHE_SERVERS=localhost
......
...@@ -22,11 +22,15 @@ if Rails.env.production? ...@@ -22,11 +22,15 @@ if Rails.env.production?
host = ENV['PORTALMEC_ELASTICSEARCH_HOST'] host = ENV['PORTALMEC_ELASTICSEARCH_HOST']
port = ENV['PORTALMEC_ELASTICSEARCH_PORT'] port = ENV['PORTALMEC_ELASTICSEARCH_PORT']
elasticsearch_client = Elasticsearch::Client.new( elasticsearch_client = Elasticsearch::Client.new(
url: host + ":" + port, url: "https://" + login + ":" + pass + "@" + host + ":" + port,
transport_options: { transport_options: {
request: { request: {
timeout: 550 timeout: 550
}#, },
ssl: {
verify: false
}
#,
#headers: { #headers: {
# Authorization: "Basic " + Base64.strict_encode64(login + ":" + pass) # Authorization: "Basic " + Base64.strict_encode64(login + ":" + pass)
#} #}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment