elasticsearch-autocomplete 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81716684e5059a3bb3781d953f1a675dcefd9f28
4
- data.tar.gz: 0a983fb4e6f859b0ee478c1711a08bae2545849e
3
+ metadata.gz: beb34ec8e44e04e7446b42e8278819603743aba7
4
+ data.tar.gz: 1557bab052b6c2dafb98ea8ea7070b405354a18f
5
5
  SHA512:
6
- metadata.gz: f05671f840c26ac3830c4c08270fb06cec45a1b3a49641fa479d28867c2aac1dbbda9281adee9a7e8a928838ed10bafb7148929ae3d7e576849edf84ab9fdbec
7
- data.tar.gz: 990ab112efe953add327bd991d5a2bef12d8df67f5bbaa071c49500084e0381ec4a4d40d21957aa5724663c0b0b44e54df40307e9bd78a3da938fb0dc3538c26
6
+ metadata.gz: 8ec4b53fa2386e4a23a8c09c6c8a3aa62a9484ef07a457557b8c39416e52b8703cdbadbca5550e2c157a589f272ad02bcf6842a4e0dfa9d7a5e908fb2c76caf7
7
+ data.tar.gz: 63c967961a6010b7784d04e4f07311b709f1fece0adcf9042554bb0dbc3013bde8ec21d3dcf05377f97b4921e41c9e999ba36c171de5aef6f55f5c418b3c6b19
@@ -1,3 +1,9 @@
1
+ ## 0.1.3
2
+
3
+ - Adding mergeable options to multi_fields
4
+ - Adding highlight hash to responses
5
+ - Updating specs to reflect highlight changing
6
+
1
7
  ## 0.1.2
2
8
 
3
9
  - Bug fix: Removing `elasticsearch.rb` so it does not conflict with Elasticsearch::Model gem
data/README.md CHANGED
@@ -106,7 +106,13 @@ search.results # => []
106
106
 
107
107
  mapping do
108
108
  # ...
109
+ # Normal
109
110
  indexes :field_name, Elasticsearch::Autocomplete::Filters.config(:field_name)
111
+
112
+ # Merge options to fields
113
+ indexes :field_name, Elasticsearch::Autocomplete::Filters.config(:field_name, {options_here: :now})
114
+
115
+ # .config returns as a hash, so you are able to merge there as well
110
116
  # ...
111
117
  end
112
118
  ```
@@ -51,15 +51,15 @@ module Elasticsearch
51
51
  }
52
52
  end
53
53
 
54
- def build_config(field)
54
+ def build_config(field, add_options_to_fields={})
55
55
  {
56
56
  :type => :multi_field,
57
57
  :fields => {
58
- field.to_sym => { type: 'string' },
59
- :"#{field}.exact" => { type: 'string', index_analyzer: 'simple' },
60
- :"#{field}.beginning" => { type: 'string', index_analyzer: 'beginning'},
61
- :"#{field}.autocomplete" => { type: 'string', index_analyzer: 'autocomplete'},
62
- :"#{field}.fuzzy" => { type: 'string', index_analyzer: 'fuzzy'}
58
+ field.to_sym => { type: 'string' }.merge(add_options_to_fields),
59
+ :"#{field}.exact" => { type: 'string', index_analyzer: 'simple' }.merge(add_options_to_fields),
60
+ :"#{field}.beginning" => { type: 'string', index_analyzer: 'beginning'}.merge(add_options_to_fields),
61
+ :"#{field}.autocomplete" => { type: 'string', index_analyzer: 'autocomplete'}.merge(add_options_to_fields),
62
+ :"#{field}.fuzzy" => { type: 'string', index_analyzer: 'fuzzy'}.merge(add_options_to_fields)
63
63
  }
64
64
  }
65
65
  end
@@ -36,6 +36,8 @@ module Elasticsearch
36
36
  src = search_result['_source']
37
37
  type = search_result['_type']
38
38
  score = search_result['_score']
39
+ highlight = search_result['highlight']
40
+
39
41
  returned_type = types.select{|t| t.type == type }.first
40
42
 
41
43
  if returned_type
@@ -44,7 +46,7 @@ module Elasticsearch
44
46
  )
45
47
  else
46
48
  src
47
- end.merge(:_score => score, :_type => type)
49
+ end.merge(:_score => score, :_type => type, :_highlight => highlight)
48
50
  end
49
51
  end
50
52
 
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Autocomplete
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-autocomplete
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - s.podlecki