elasticsearch_autocomplete 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -1
- data/lib/elasticsearch_autocomplete.rb +2 -1
- data/lib/elasticsearch_autocomplete/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ElasticsearchAutocomplete
|
2
2
|
|
3
|
-
Simple autocomplete for rails models using awesome elasticsearch and tire gem
|
3
|
+
Simple autocomplete for rails models using awesome [Elasticsearch](http://www.elasticsearch.org/) and [tire](https://github.com/karmi/tire) gem
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -26,6 +26,12 @@ class User < ActiveRecord::Base
|
|
26
26
|
end
|
27
27
|
```
|
28
28
|
|
29
|
+
Don't forget to rebuild elasticsearch index:
|
30
|
+
|
31
|
+
```bash
|
32
|
+
$ rake environment tire:import CLASS='User' FORCE=true
|
33
|
+
```
|
34
|
+
|
29
35
|
To find suggestions call `ac_search` method on your model. It return `Tire::Results::Collection` instance:
|
30
36
|
|
31
37
|
```ruby
|
@@ -20,7 +20,8 @@ module ElasticsearchAutocomplete
|
|
20
20
|
|
21
21
|
def self.val_to_array(val, zero=false)
|
22
22
|
return [] unless val
|
23
|
-
|
23
|
+
return val if val.is_a?(Array)
|
24
|
+
a = val.to_s.split(',').map(&:to_i)
|
24
25
|
zero ? a : a.reject(&:zero?)
|
25
26
|
end
|
26
27
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: elasticsearch_autocomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alex Leschenko
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
segments:
|
116
116
|
- 0
|
117
|
-
hash:
|
117
|
+
hash: -638938333914231974
|
118
118
|
none: false
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
segments:
|
125
125
|
- 0
|
126
|
-
hash:
|
126
|
+
hash: -638938333914231974
|
127
127
|
none: false
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|