Commit 70d116cf64865b868792a8f0802bd6da1aaa0847
1 parent
755ef3bc
Exists in
elasticsearch_api
check :weight exists
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb
... | ... | @@ -28,7 +28,13 @@ class ElasticsearchPluginController < ApplicationController |
28 | 28 | query = {} |
29 | 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 | 39 | query = { |
34 | 40 | query: { | ... | ... |