insuggest 0.0.2 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5a8c2eff302b8f1b57dc43e529ca265bd6de977
4
- data.tar.gz: ba44cb8de19603fe7f6fcb59523a5e759bc3003e
3
+ metadata.gz: 71b35b62023b241ecbf0b4bb22434b46142ef90a
4
+ data.tar.gz: 2b5e569ea100cd3f4033e93e8104595658739b7f
5
5
  SHA512:
6
- metadata.gz: 9a75d3134efdcbe9660b0841deca74e11ba77f4b77ee4d5dc4b57e54c2716a17239f37ade38b6b53d3ca28d3bd96e1efa1e202bee7c3eb81831cf119f2935d6f
7
- data.tar.gz: 71b4dc58a212686f6a46da50fc20431b669a5ce2fb001164a2d41ace462615b9bb5d2299fc86373a49993f55df8bcd38aa9f3c2a359ef3ff242c60706b27ae3d
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
@@ -1,3 +1,3 @@
1
1
  module Insuggest
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/insuggest.rb CHANGED
@@ -5,4 +5,5 @@ require "insuggest/discount"
5
5
  require "insuggest/depreciation"
6
6
  require "insuggest/gcv/discount"
7
7
  require "insuggest/gcv/depreciation"
8
+ require "insuggest/idv"
8
9
  require "insuggest/version"
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.2
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-17 00:00:00.000000000 Z
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: