elasticsearch-autocomplete 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +6 -0
- data/lib/elasticsearch/autocomplete/filters.rb +6 -6
- data/lib/elasticsearch/autocomplete/response.rb +3 -1
- data/lib/elasticsearch/autocomplete/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beb34ec8e44e04e7446b42e8278819603743aba7
|
4
|
+
data.tar.gz: 1557bab052b6c2dafb98ea8ea7070b405354a18f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ec4b53fa2386e4a23a8c09c6c8a3aa62a9484ef07a457557b8c39416e52b8703cdbadbca5550e2c157a589f272ad02bcf6842a4e0dfa9d7a5e908fb2c76caf7
|
7
|
+
data.tar.gz: 63c967961a6010b7784d04e4f07311b709f1fece0adcf9042554bb0dbc3013bde8ec21d3dcf05377f97b4921e41c9e999ba36c171de5aef6f55f5c418b3c6b19
|
data/CHANGELOG.md
CHANGED
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
|
|