From 5007c9709ea43a32e7c0cc1f5c3ea20b1a928725 Mon Sep 17 00:00:00 2001 From: ArthurJahn Date: Tue, 7 Jun 2016 14:47:59 +0000 Subject: [PATCH] Elasticsearch: fixes for search mapping --- plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb | 2 +- plugins/elasticsearch/lib/ext/article.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 plugins/elasticsearch/lib/ext/article.rb diff --git a/plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb b/plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb index 18592da..77e4307 100644 --- a/plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb +++ b/plugins/elasticsearch/controllers/elasticsearch_plugin_controller.rb @@ -33,7 +33,7 @@ class ElasticsearchPluginController < ApplicationController def get_query text, klass query = {} unless text.blank? - + text = text.downcase fields = klass::SEARCHABLE_FIELDS.map do |key, value| if value[:weight] "#{key}^#{value[:weight]}" diff --git a/plugins/elasticsearch/lib/ext/article.rb b/plugins/elasticsearch/lib/ext/article.rb new file mode 100644 index 0000000..ff88a31 --- /dev/null +++ b/plugins/elasticsearch/lib/ext/article.rb @@ -0,0 +1,13 @@ +require_dependency 'article' +require_relative '../elasticsearch_indexed_model' + +class Article + include ElasticsearchIndexedModel + + def self.control_fields + [ + :advertise, + :published, + ] + end +end -- libgit2 0.21.2