From 5b454a99aca57ccc22437a9fefeef632dae04162 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 31 Jul 2013 22:48:11 -0700 Subject: [PATCH] Use navigation notation to prevent name conflicts --- lib/searchkick/reindex.rb | 5 +++-- lib/searchkick/search.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/searchkick/reindex.rb b/lib/searchkick/reindex.rb index 3a8e913..004bd9d 100644 --- a/lib/searchkick/reindex.rb +++ b/lib/searchkick/reindex.rb @@ -118,10 +118,11 @@ module Searchkick match: "*", match_mapping_type: "string", mapping: { + # http://www.elasticsearch.org/guide/reference/mapping/multi-field-type/ type: "multi_field", fields: { - "{name}_analyzed" => {type: "string", index: "analyzed"}, - "{name}" => {type: "string", index: "not_analyzed"} + "{name}" => {type: "string", index: "not_analyzed"}, + "analyzed" => {type: "string", index: "analyzed"} } } } diff --git a/lib/searchkick/search.rb b/lib/searchkick/search.rb index e22f1e8..4ab8ed4 100644 --- a/lib/searchkick/search.rb +++ b/lib/searchkick/search.rb @@ -3,7 +3,7 @@ module Searchkick def search(term, options = {}) term = term.to_s - fields = options[:fields] ? options[:fields].map{|f| "#{f}_analyzed" } : ["_all"] + fields = options[:fields] ? options[:fields].map{|f| "#{f}.analyzed" } : ["_all"] operator = options[:partial] ? "or" : "and" load = options[:load].nil? ? true : options[:load] load = (options[:include] || true) if load -- libgit2 0.21.0