CloudSesame 0.2.0 → 0.2.1
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/Gemfile.lock +1 -1
- data/cloud_sesame.gemspec +1 -1
- data/lib/cloud_sesame/query/node/facet.rb +3 -0
- data/lib/cloud_sesame/query/node/request.rb +1 -0
- data/spec/cloud_sesame_spec.rb +79 -79
- 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: b03fae31220d970463fd33113b6a59c9ab0e7954
|
|
4
|
+
data.tar.gz: 91253e2158baac1a5927f9391c10af5dd2ce3184
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8167fb00a861a2d9a9fd9796aae670e43dc17d1ec88d895a137935336b32f921d16e3155b44a2d940caa3b723af40d627ac14a797ca125986d3e9287482dd2a4
|
|
7
|
+
data.tar.gz: 6eb69016ada8ff183a69219284d7ea9408b648182c4b6b15bc00450b09b7a25b591273dec100530d22fa0e0885bd56e0cd862f8f6cc9d0c9f3f089cd70a5e634
|
data/Gemfile.lock
CHANGED
data/cloud_sesame.gemspec
CHANGED
data/spec/cloud_sesame_spec.rb
CHANGED
|
@@ -2,85 +2,85 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe CloudSesame do
|
|
4
4
|
|
|
5
|
-
# AWS initializer
|
|
6
|
-
require 'yaml'
|
|
7
|
-
YAML.load_file('aws.yml').each do |key, value|
|
|
8
|
-
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Domain Initializer /config/initializers/cloudsearch.rb
|
|
12
|
-
require 'cloud_sesame'
|
|
13
|
-
|
|
14
|
-
CloudSesame::Domain::Client.configure do |config|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Usage Example
|
|
20
|
-
class Product
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
class NewProduct < Product
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# Example Query
|
|
69
|
-
query = Product.cloudsearch.query("children panasonic")
|
|
70
|
-
.and {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}.created_at(Date.today).description("wasup")
|
|
5
|
+
# # AWS initializer
|
|
6
|
+
# require 'yaml'
|
|
7
|
+
# YAML.load_file('aws.yml').each do |key, value|
|
|
8
|
+
# ENV["AWS_#{ key }"] = value
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
# # Domain Initializer /config/initializers/cloudsearch.rb
|
|
12
|
+
# require 'cloud_sesame'
|
|
13
|
+
|
|
14
|
+
# CloudSesame::Domain::Client.configure do |config|
|
|
15
|
+
# config.access_key = ENV['AWS_ACCESS_KEY_ID']
|
|
16
|
+
# config.secret_key = ENV['AWS_SECRET_ACCESS_KEY']
|
|
17
|
+
# end
|
|
18
|
+
|
|
19
|
+
# # Usage Example
|
|
20
|
+
# class Product
|
|
21
|
+
# include CloudSesame
|
|
22
|
+
|
|
23
|
+
# define_cloudsearch do
|
|
24
|
+
# # Product CloudSesame Config
|
|
25
|
+
# config.endpoint = ENV['AWS_ENDPOINT']
|
|
26
|
+
# config.region = ENV['AWS_REGION']
|
|
27
|
+
|
|
28
|
+
# default_size 100
|
|
29
|
+
|
|
30
|
+
# define_sloppiness 3
|
|
31
|
+
|
|
32
|
+
# define_fuzziness do
|
|
33
|
+
# max_fuzziness 3
|
|
34
|
+
# min_char_size 6
|
|
35
|
+
# fuzzy_percent 0.17
|
|
36
|
+
# end
|
|
37
|
+
|
|
38
|
+
# field :searchable_text, query: { weight: 2 }
|
|
39
|
+
# field :description, query: true
|
|
40
|
+
# field :tags
|
|
41
|
+
|
|
42
|
+
# field :affiliate_advertiser_ext_id, facet: { size: 50 }
|
|
43
|
+
# field :currency, facet: true
|
|
44
|
+
# field :discount_percentage, facet: { buckets: %w([10,100] [25,100] [50,100] [70,100]), method: 'interval' }
|
|
45
|
+
# field :manufacturer_name, facet: { size: 50 }
|
|
46
|
+
# field :price, facet: { buckets: %w([0,25] [25,50] [50,100] [100,200] [200,}), method: 'interval' }
|
|
47
|
+
# field :category_string, facet: { sort: 'bucket', size: 10_000 }
|
|
48
|
+
# field :created_at
|
|
49
|
+
|
|
50
|
+
# scope :men_tag, ->(date) { created_at date }
|
|
51
|
+
# scope :and_mens do
|
|
52
|
+
# and! { tags "men"}
|
|
53
|
+
# end
|
|
54
|
+
|
|
55
|
+
# end
|
|
56
|
+
|
|
57
|
+
# end
|
|
58
|
+
|
|
59
|
+
# class NewProduct < Product
|
|
60
|
+
# load_definition_from Product
|
|
61
|
+
|
|
62
|
+
# define_cloudsearch do
|
|
63
|
+
# field :searchable_text, query: { weight: 4 }
|
|
64
|
+
# field :name, as: :text1
|
|
65
|
+
# end
|
|
66
|
+
# end
|
|
67
|
+
|
|
68
|
+
# # Example Query
|
|
69
|
+
# query = Product.cloudsearch.query("children panasonic")
|
|
70
|
+
# .and {
|
|
71
|
+
# or!(boost: 2) {
|
|
72
|
+
# # tags.not start_with "flash_deal"
|
|
73
|
+
# tags.not.start_with "flash_deal"
|
|
74
|
+
# # tags.near"sales"
|
|
75
|
+
# # tags start_with("flash_deal"), near("sales")
|
|
76
|
+
# }
|
|
77
|
+
# or!.not {
|
|
78
|
+
# currency "CAD", "EUR"
|
|
79
|
+
# }
|
|
80
|
+
# and! {
|
|
81
|
+
# price r.gte(100).lt(200)
|
|
82
|
+
# }
|
|
83
|
+
# }.created_at(Date.today).description("wasup")
|
|
84
84
|
|
|
85
85
|
# binding.pry
|
|
86
86
|
|