Commit 2bdd801fbf5140854557cdb5675bde8c96d95314

Authored by Joenio Costa
Committed by Macartur Sousa
1 parent 7a726048
Exists in elasticsearch_view

check :weight exists

plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb
@@ -28,7 +28,13 @@ class ElasticsearchPluginController < ApplicationController @@ -28,7 +28,13 @@ class ElasticsearchPluginController < ApplicationController
28 query = {} 28 query = {}
29 unless text.blank? 29 unless text.blank?
30 30
31 - fields = klass::SEARCHABLE_FIELDS.map {|k, v| "#{k}^#{v[:weight]}"} 31 + fields = klass.indexable_fields.map do |key, value|
  32 + if value[:weight]
  33 + "#{k}^#{v[:weight]}"
  34 + else
  35 + "#{k}"
  36 + end
  37 + end
32 38
33 query = { 39 query = {
34 query: { 40 query: {