CloudSesame 0.6.2 → 0.6.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: 44c7ef9d947994c9b816ee05d8cb55d2ff003523
4
- data.tar.gz: 92fec171662d7c03d8e64a7bf6e2ebba77028481
3
+ metadata.gz: 4fdb2634b1b55f6cbaa96a600d51e02a3101375b
4
+ data.tar.gz: 7cd0bdbd88008889545db507cfea3f7aa835badd
5
5
  SHA512:
6
- metadata.gz: c73bfb9511181436cd79bc07ee62dde2f91cf30e4c08c2dadd64baba4570e018221042ceba6bc72ac2ce8d59df6a401fec39f203696cb1e2b7423ff93286b7f2
7
- data.tar.gz: 5019189b02a0e1a20bb308762e364c389ac10d8d35af6edafc904d8fa04568def1774a1025a7d7dcbd8170bffb1ce768db38d9637bd02427cc7bb67c57e8b3bc
6
+ metadata.gz: 27cc4302d367523be656a30dcbb178c2d0f11f1dbda8cb14f6055eaf84ba5e841f330654066946fa6d0c3ba1863be37cbd16d350eed7427ce3f30d4121294cbb
7
+ data.tar.gz: d082a24dbd0be07160527a034be3b75955d45cf51d07055fc43411894d6a65f5dbfd6f5b821a7e5f1a1a1d72397138b924ccf44a0964f33bb8154267a146bca7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- CloudSesame (0.6.2)
4
+ CloudSesame (0.6.3)
5
5
  aws-sdk (~> 2)
6
6
 
7
7
  GEM
data/cloud_sesame.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'CloudSesame'
3
- s.version = '0.6.2'
3
+ s.version = '0.6.3'
4
4
  s.date = '2016-02-09'
5
5
  s.summary = "AWS CloudSearch Query DSL"
6
6
  s.description = "AWS CloudSearch Query DSL"
@@ -26,11 +26,15 @@ module CloudSesame
26
26
  results.map &block
27
27
  end
28
28
 
29
+ def hash_key(compiled)
30
+ Digest::MD5.hexdigest(JSON.generate(compiled.merge(searchable: searchable.to_s)))
31
+ end
32
+
29
33
  def search
30
34
  compiled = request.compile
31
35
  raise Error::MissingQuery.new("Query or FilterQuery can not be empty!") if !compiled[:query] || compiled[:query].empty?
32
36
  if context[:cache]
33
- @response = Rails.cache.fetch(compiled.merge({ searchable: searchable })) do
37
+ @response = Rails.cache.fetch(hash_key(compiled)) do
34
38
  results = searchable.cloudsearch.client.search compiled
35
39
  OpenStruct.new(status: results.status, hits: results.hits, facets: results.facets)
36
40
  end
@@ -56,12 +56,14 @@
56
56
  # field :manufacturer_name, facet: { size: 50 }
57
57
  # field :price, facet: { buckets: %w([0,25] [25,50] [50,100] [100,200] [200,}), method: 'interval' }
58
58
  # field :category_string, facet: { sort: 'bucket', size: 10_000 }
59
- # field :created_at, default: -> { Time.now }
59
+ # field :created_at
60
60
 
61
61
  # end
62
62
 
63
63
  # end
64
64
 
65
+ # q = Product.cloudsearch.query("shoes").and{ price gte 100 }.page(2)
66
+ # binding.pry
65
67
 
66
68
  # # @tags = [1, 2]
67
69
  # # n = 10_000
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CloudSesame
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chu
@@ -21,84 +21,84 @@ dependencies:
21
21
  name: aws-sdk
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rspec
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: pry
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: guard
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: guard-rspec
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: ruby-prof
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  description: AWS CloudSearch Query DSL
@@ -107,8 +107,8 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
- - .gitignore
111
- - .rspec
110
+ - ".gitignore"
111
+ - ".rspec"
112
112
  - Gemfile
113
113
  - Gemfile.lock
114
114
  - Guardfile
@@ -212,17 +212,17 @@ require_paths:
212
212
  - lib
213
213
  required_ruby_version: !ruby/object:Gem::Requirement
214
214
  requirements:
215
- - - '>='
215
+ - - ">="
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - '>='
220
+ - - ">="
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  requirements: []
224
224
  rubyforge_project:
225
- rubygems_version: 2.4.8
225
+ rubygems_version: 2.5.1
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: AWS CloudSearch Query DSL