insuggest 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/insuggest/idv.rb +80 -0
- data/lib/insuggest/version.rb +1 -1
- data/lib/insuggest.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71b35b62023b241ecbf0b4bb22434b46142ef90a
|
4
|
+
data.tar.gz: 2b5e569ea100cd3f4033e93e8104595658739b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34806b5d03954ccca919ac5b53453fe028b6c1af27759abbfb3707e848d0da13f9501e9ab2d89d1fe8383134abaeda686dac7843f8e52442570922d2af3e8e08
|
7
|
+
data.tar.gz: b7e47d972dbcf2b314beebca33a23fc5ef04479af721c671a50e2009171d4b8f344682153795c5a06821a1ef0b393be8e64f0afd85aabdfbb440aed0dff79081
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Insuggest
|
2
|
+
module Idv
|
3
|
+
attr_reader :attributes
|
4
|
+
|
5
|
+
def initialize(attributes={})
|
6
|
+
@attributes = attributes
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hash
|
10
|
+
@attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def get_index_name
|
16
|
+
"idvs"
|
17
|
+
end
|
18
|
+
|
19
|
+
def repository
|
20
|
+
index_name = get_index_name
|
21
|
+
Elasticsearch::Persistence::Repository.new do
|
22
|
+
index index_name
|
23
|
+
type :idv
|
24
|
+
settings number_of_shards: 4 do
|
25
|
+
mapping do
|
26
|
+
indexes :suggest_make, type: 'completion',
|
27
|
+
payloads: true,
|
28
|
+
index_analyzer: "simple",
|
29
|
+
search_analyzer: "simple"
|
30
|
+
indexes :suggest_model, type: 'completion',
|
31
|
+
payloads: true,
|
32
|
+
index_analyzer: "simple",
|
33
|
+
search_analyzer: "simple"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def search(query=[], size= 100, age=1, percent)
|
40
|
+
self.repository.search({
|
41
|
+
size: size,
|
42
|
+
query: {
|
43
|
+
bool: {
|
44
|
+
must: [
|
45
|
+
{
|
46
|
+
match: {
|
47
|
+
make: {
|
48
|
+
query: query[0],
|
49
|
+
minimum_should_match: percent[0]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
},
|
53
|
+
{
|
54
|
+
match: {
|
55
|
+
model: {
|
56
|
+
query: query[1],
|
57
|
+
minimum_should_match: percent[1]
|
58
|
+
}
|
59
|
+
}
|
60
|
+
},
|
61
|
+
{
|
62
|
+
match: {
|
63
|
+
fuel_type: {
|
64
|
+
query: query[2],
|
65
|
+
minimum_should_match: '90%'
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
]
|
70
|
+
}
|
71
|
+
}
|
72
|
+
})
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.included(base)
|
77
|
+
base.extend(ClassMethods)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/insuggest/version.rb
CHANGED
data/lib/insuggest.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insuggest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shailesh Patil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/insuggest/discount.rb
|
114
114
|
- lib/insuggest/gcv/depreciation.rb
|
115
115
|
- lib/insuggest/gcv/discount.rb
|
116
|
+
- lib/insuggest/idv.rb
|
116
117
|
- lib/insuggest/version.rb
|
117
118
|
homepage: ''
|
118
119
|
licenses:
|