eden_cloud_search 0.1.10

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.
Files changed (37) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +1 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +13 -0
  5. data/Guardfile +10 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +142 -0
  8. data/Rakefile +9 -0
  9. data/eden_cloud_search.gemspec +30 -0
  10. data/lib/eden_cloud_search/config.rb +62 -0
  11. data/lib/eden_cloud_search/document.rb +95 -0
  12. data/lib/eden_cloud_search/exceptions.rb +3 -0
  13. data/lib/eden_cloud_search/indexer.rb +44 -0
  14. data/lib/eden_cloud_search/invalid_document.rb +11 -0
  15. data/lib/eden_cloud_search/search_response.rb +73 -0
  16. data/lib/eden_cloud_search/searcher.rb +118 -0
  17. data/lib/eden_cloud_search/version.rb +3 -0
  18. data/lib/eden_cloud_search.rb +24 -0
  19. data/spec/cloud_search/config_spec.rb +23 -0
  20. data/spec/cloud_search/document_spec.rb +335 -0
  21. data/spec/cloud_search/indexer_spec.rb +146 -0
  22. data/spec/cloud_search/invalid_document_spec.rb +9 -0
  23. data/spec/cloud_search/search_response_spec.rb +220 -0
  24. data/spec/cloud_search/searcher_spec.rb +254 -0
  25. data/spec/fixtures/full.json +1 -0
  26. data/spec/fixtures/vcr_cassettes/index/request/add.yml +38 -0
  27. data/spec/fixtures/vcr_cassettes/index/request/add_in_batch.yml +40 -0
  28. data/spec/fixtures/vcr_cassettes/index/request/delete.yml +37 -0
  29. data/spec/fixtures/vcr_cassettes/search/request/facets.yml +121 -0
  30. data/spec/fixtures/vcr_cassettes/search/request/facets_with_constraints.yml +123 -0
  31. data/spec/fixtures/vcr_cassettes/search/request/full.yml +114 -0
  32. data/spec/fixtures/vcr_cassettes/search/request/paginated.yml +36 -0
  33. data/spec/fixtures/vcr_cassettes/search/request/paginated_first_page.yml +56 -0
  34. data/spec/fixtures/vcr_cassettes/search/request/paginated_second_page.yml +81 -0
  35. data/spec/spec_helper.rb +17 -0
  36. data/spec/support/vcr.rb +5 -0
  37. metadata +212 -0
@@ -0,0 +1,220 @@
1
+ require "spec_helper"
2
+
3
+ describe CloudSearch::SearchResponse do
4
+ subject { described_class.new }
5
+
6
+ context "when there are results" do
7
+ before do
8
+ subject.body = File.read File.expand_path("../../fixtures/full.json", __FILE__)
9
+ end
10
+
11
+ describe "#results" do
12
+ it "list matched documents" do
13
+ subject.results.map{ |item| item['data']['title'] }.flatten
14
+ .should == ["Star Wars: The Clone Wars",
15
+ "Star Wars",
16
+ "Star Wars: Episode II - Attack of the Clones",
17
+ "Star Wars: Episode V - The Empire Strikes Back",
18
+ "Star Wars: Episode VI - Return of the Jedi",
19
+ "Star Wars: Episode I - The Phantom Menace",
20
+ "Star Wars: Episode III - Revenge of the Sith"]
21
+ end
22
+ end
23
+
24
+ describe "#hits" do
25
+ it "returns number of hits" do
26
+ subject.hits.should == 7
27
+ end
28
+ end
29
+
30
+ describe "#total_entries" do
31
+ it "returns same value from hits" do
32
+ subject.hits.should == subject.total_entries
33
+ end
34
+ end
35
+
36
+ describe "#has_pagination?" do
37
+ it "when hits is greater than items_per_page returns true" do
38
+ subject.items_per_page = 8
39
+ subject.has_pagination?.should == false
40
+ end
41
+
42
+ it "when hits is less than items_per_page returns false" do
43
+ subject.items_per_page = 6
44
+ subject.has_pagination?.should == true
45
+ end
46
+
47
+ it "when hits is equal to items_per_page returns false" do
48
+ subject.items_per_page = 7
49
+ subject.has_pagination?.should == false
50
+ end
51
+ end
52
+
53
+ describe "#found?" do
54
+ it "returns true when found documents" do
55
+ subject.should be_found
56
+ end
57
+ end
58
+
59
+ describe "#any?" do
60
+ it "returns true when has found results" do
61
+ subject.should be_any
62
+ end
63
+ end
64
+
65
+ describe "#items_per_page" do
66
+ it "returns items per page as default 10" do
67
+ subject.items_per_page.should == 10
68
+ end
69
+
70
+ it "is an alias to limit_value" do
71
+ subject.limit_value.should == 10
72
+ end
73
+ end
74
+
75
+ describe "#page_size" do
76
+ it "returns number of items per page" do
77
+ subject.items_per_page.should == subject.items_per_page
78
+ end
79
+ end
80
+
81
+ describe "#offset" do
82
+ it "returns offset as default 0" do
83
+ subject.offset.should == 0
84
+ end
85
+ end
86
+
87
+ describe "#facets" do
88
+ it "returns all facets" do
89
+ subject.facets.keys.should == ['genre', 'year']
90
+ end
91
+
92
+ it "returns facets details" do
93
+ subject.facets['genre'].should == { "Action" => 7,
94
+ "Adventure" => 7, "Sci-Fi" => 7, "Fantasy" => 5,
95
+ "Animation" => 1, "Family" => 1, "Thriller" => 1 }
96
+
97
+ subject.facets['year'].should == {"min"=>1977, "max"=>2008}
98
+ end
99
+ end
100
+ end
101
+
102
+ context "when there aren't results" do
103
+ before do
104
+ subject.body = "{}"
105
+ end
106
+
107
+ describe "#results" do
108
+ it "list matched documents" do
109
+ subject.results.size.should == 0
110
+ end
111
+ end
112
+
113
+ describe "#hits" do
114
+ it "returns number of hits" do
115
+ subject.hits.should == 0
116
+ end
117
+ end
118
+
119
+ describe "#found?" do
120
+ it "returns false when not found documents" do
121
+ subject.should_not be_found
122
+ end
123
+ end
124
+
125
+ describe "#items_per_page" do
126
+ it "returns items per page" do
127
+ subject.items_per_page.should == 10
128
+ end
129
+ end
130
+
131
+ describe "#page_size" do
132
+ it "returns number of items per page" do
133
+ subject.items_per_page.should == subject.items_per_page
134
+ end
135
+ end
136
+
137
+ describe "#offset" do
138
+ it "returns offset" do
139
+ subject.offset.should == 0
140
+ end
141
+ end
142
+ end
143
+
144
+ context "pagination" do
145
+ let(:seven_hits) { File.read File.expand_path("../../fixtures/full.json", __FILE__) }
146
+ let(:seven_hits_hash) { JSON.parse(seven_hits) }
147
+
148
+
149
+ it "returns number of pages based on hits" do
150
+ subject.items_per_page = 8
151
+ subject.body = seven_hits
152
+ subject.total_pages.should == 1
153
+
154
+ subject.items_per_page = 7
155
+ subject.body = seven_hits
156
+ subject.total_pages.should == 1
157
+
158
+ subject.items_per_page = 6
159
+ subject.body = seven_hits
160
+ subject.total_pages.should == 2
161
+
162
+ subject.items_per_page = 5
163
+ subject.body = seven_hits
164
+ subject.total_pages.should == 2
165
+
166
+ subject.items_per_page = 4
167
+ subject.body = seven_hits
168
+ subject.total_pages.should == 2
169
+
170
+ subject.items_per_page = 3
171
+ subject.body = seven_hits
172
+ subject.total_pages.should == 3
173
+
174
+ subject.items_per_page = 2
175
+ subject.body = seven_hits
176
+ subject.total_pages.should == 4
177
+
178
+ subject.items_per_page = 1
179
+ subject.body = seven_hits
180
+ subject.total_pages.should == 7
181
+ end
182
+
183
+ it "returns current page based on start and items per page" do
184
+ subject.items_per_page = 3
185
+ seven_hits_hash['hits']['start'] = nil
186
+ subject.body = seven_hits_hash.to_json
187
+ subject.current_page.should == 1
188
+
189
+ subject.items_per_page = 3
190
+ seven_hits_hash['hits']['start'] = 0
191
+ subject.body = seven_hits_hash.to_json
192
+ subject.current_page.should == 1
193
+
194
+ subject.items_per_page = 3
195
+ seven_hits_hash['hits']['start'] = 2
196
+ subject.body = seven_hits_hash.to_json
197
+ subject.current_page.should == 1
198
+
199
+ subject.items_per_page = 3
200
+ seven_hits_hash['hits']['start'] = 3
201
+ subject.body = seven_hits_hash.to_json
202
+ subject.current_page.should == 2
203
+
204
+ subject.items_per_page = 3
205
+ seven_hits_hash['hits']['start'] = 4
206
+ subject.body = seven_hits_hash.to_json
207
+ subject.current_page.should == 2
208
+
209
+ subject.items_per_page = 3
210
+ seven_hits_hash['hits']['start'] = 5
211
+ subject.body = seven_hits_hash.to_json
212
+ subject.current_page.should == 2
213
+
214
+ subject.items_per_page = 3
215
+ seven_hits_hash['hits']['start'] = 6
216
+ subject.body = seven_hits_hash.to_json
217
+ subject.current_page.should == 3
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,254 @@
1
+ require "spec_helper"
2
+
3
+ describe CloudSearch::Searcher do
4
+ subject(:searcher) { described_class.new }
5
+ let(:url_prefix) { "#{CloudSearch.config.search_url}/search?" }
6
+
7
+ before do
8
+ searcher.with_query('lsdakfusur')
9
+ end
10
+
11
+ describe "#with_query" do
12
+ it "returns #{described_class} instance" do
13
+ searcher.with_query("foo").should == searcher
14
+ end
15
+
16
+ it "sets the query parameter in the search url" do
17
+ searcher.with_query("foo").params.should include('q' => 'foo')
18
+ end
19
+
20
+ it "escapes the search term" do
21
+ searcher.with_query("f&oo").params.should include('q' => 'f%26oo')
22
+ end
23
+ end
24
+
25
+ describe "#with_boolean_query" do
26
+ it "return #{described_class} instance" do
27
+ searcher.with_boolean_query(:foo => 'bar').should == searcher
28
+ end
29
+
30
+ it "sets the boolean query parameter in the search url" do
31
+ searcher.with_boolean_query(:foo => 'bar').params.should include('bq' => "(and foo:'bar')")
32
+ end
33
+
34
+ it "escapes search terms" do
35
+ searcher.with_boolean_query(:foo => 'ba&r').params.should include('bq' => "(and foo:'ba%26r')")
36
+ end
37
+
38
+ it "sets search terms with multiple acceptable values" do
39
+ searcher.with_boolean_query(:foo => ['bar', 'baz']).params.should include("bq" => "(and foo:'bar|baz')")
40
+ end
41
+
42
+ it "sets multiple search keys" do
43
+ searcher.with_boolean_query(:foo => 'bar', :baz => ['zaz', 'traz']).params.should include("bq" => "(and foo:'bar' baz:'zaz|traz')")
44
+ end
45
+ end
46
+
47
+ describe "#with_facet" do
48
+ it "setup facets" do
49
+ searcher.with_facets("foo", "bar").params.should include("facet" => "foo,bar")
50
+ end
51
+ end
52
+
53
+ describe "#ranked_by" do
54
+ it "returns the instance" do
55
+ searcher.ranked_by("foobar").should == searcher
56
+ end
57
+
58
+ it "sets the rank expression in the searcher object" do
59
+ searcher.ranked_by("foobar").params.should include("rank" => "foobar")
60
+ end
61
+ end
62
+
63
+ describe "#with_fields" do
64
+ it "returns #{described_class} instance" do
65
+ searcher.with_fields(:foo).should == searcher
66
+ end
67
+
68
+ it "setup more thane one value" do
69
+ searcher.with_fields(:foo, :bar, :foobar)
70
+ end
71
+
72
+ it "returns cloud search url with foo and bar fields" do
73
+ searcher.with_fields(:foo, :bar).params.should include("return-fields" => "foo,bar")
74
+ end
75
+ end
76
+
77
+ describe "#items_per_page" do
78
+ it "returns default items_per_page" do
79
+ searcher.items_per_page.should == 10
80
+ end
81
+
82
+ it "returns default items per page when it's tried to set nil value" do
83
+ searcher.with_items_per_page(nil)
84
+ searcher.items_per_page.should == 10
85
+ end
86
+ end
87
+
88
+ describe "#with_items_per_page" do
89
+ it "returns #{described_class} instance" do
90
+ searcher.with_items_per_page(nil).should == searcher
91
+ end
92
+
93
+ it "setup items per page" do
94
+ searcher.with_items_per_page(100)
95
+ searcher.items_per_page.should == 100
96
+ end
97
+
98
+ it "returns cloud search url with size equals 20" do
99
+ searcher.with_items_per_page(20).params.should include("size" => 20)
100
+ end
101
+ end
102
+
103
+ describe "#page_number" do
104
+ it "returns default page number" do
105
+ searcher.page_number.should == 1
106
+ end
107
+
108
+ it "returns default page number when it's tried to set nil value" do
109
+ searcher.at_page(nil)
110
+ searcher.page_number.should == 1
111
+ end
112
+ end
113
+
114
+ describe "#at_page" do
115
+ it "returns #{described_class} instance" do
116
+ searcher.at_page(1).should == searcher
117
+ end
118
+
119
+ it "setup page number" do
120
+ searcher.at_page(2)
121
+ searcher.page_number.should == 2
122
+ end
123
+
124
+ it "ensure page is greater than 1" do
125
+ searcher.at_page(0)
126
+ searcher.page_number.should == 1
127
+
128
+ searcher.at_page(-1)
129
+ searcher.page_number.should == 1
130
+ end
131
+
132
+ it "returns cloud search url with start at 10" do
133
+ searcher.at_page(2).params.should include("start" => 10)
134
+ end
135
+ end
136
+
137
+ describe "#with_filters" do
138
+ it "adds filters to the search" do
139
+ searcher.with_query("foo").with_filters('t-product_active' => 1, 't-brand_active' => 2)
140
+ searcher.params.should include("t-product_active" => 1, "t-brand_active" => 2)
141
+ end
142
+ end
143
+
144
+ describe "#start" do
145
+ it "returns default start index number to search" do
146
+ searcher.start.should == 0
147
+ end
148
+
149
+ it "returns start index 10 for page 2" do
150
+ searcher.at_page(2)
151
+ searcher.start.should == 10
152
+ end
153
+ end
154
+
155
+ describe "#url" do
156
+ it "raises an error if neither query nor boolean query are defined" do
157
+ expect { described_class.new.params }.to raise_error CloudSearch::InsufficientParametersException
158
+ end
159
+ end
160
+
161
+ describe "#search" do
162
+ before do
163
+ searcher
164
+ .with_fields(:actor, :director, :title, :year, :text_relevance)
165
+ .with_query("star wars")
166
+ end
167
+
168
+ context "when the domain id was not configured" do
169
+ around do |example|
170
+ domain_id = CloudSearch.config.domain_id
171
+ CloudSearch.config.domain_id = nil
172
+ example.call
173
+ CloudSearch.config.domain_id = domain_id
174
+ end
175
+
176
+ it "raises an error" do
177
+ expect {
178
+ searcher.search
179
+ }.to raise_error(CloudSearch::MissingConfigurationError, "Missing 'domain_id' configuration parameter")
180
+ end
181
+ end
182
+
183
+ context "when the domain name was not configured" do
184
+ around do |example|
185
+ domain_name = CloudSearch.config.domain_name
186
+ CloudSearch.config.domain_name = nil
187
+ example.call
188
+ CloudSearch.config.domain_name = domain_name
189
+ end
190
+
191
+ it "raises an error" do
192
+ expect {
193
+ searcher.search
194
+ }.to raise_error(CloudSearch::MissingConfigurationError, "Missing 'domain_name' configuration parameter")
195
+ end
196
+ end
197
+
198
+ context "when search" do
199
+ around { |example| VCR.use_cassette "search/request/full", &example }
200
+
201
+ it "returns http 200 code" do
202
+ resp = searcher.search
203
+ resp.http_code.should == 200
204
+ end
205
+
206
+ it "has found results" do
207
+ resp = searcher.search
208
+ resp.should be_found
209
+ end
210
+
211
+ it "returns number of hits" do
212
+ resp = searcher.search
213
+ expect(resp.hits).to be == 7
214
+ end
215
+
216
+ it "returns Episode II" do
217
+ resp = searcher.search
218
+ resp.results.map{ |item| item['data']['title'] }.flatten
219
+ .should include "Star Wars: Episode II - Attack of the Clones"
220
+ end
221
+
222
+ it "returns facets" do
223
+ VCR.use_cassette "search/request/facets" do
224
+ searcher.with_facets(:genre, :year)
225
+ resp = searcher.search
226
+ resp.facets.should == {"genre"=>{"Action"=>7, "Adventure"=>7, "Sci-Fi"=>7, "Fantasy"=>5, "Animation"=>1, "Family"=>1, "Thriller"=>1}, "year"=>{"min"=>1977, "max"=>2008}}
227
+ end
228
+ end
229
+ end
230
+
231
+ context "when paginate result" do
232
+ it "returns first page" do
233
+ VCR.use_cassette "search/request/paginated_first_page" do
234
+ searcher.with_items_per_page(4)
235
+ searcher.at_page(1)
236
+ resp = searcher.search
237
+ resp.results.map{ |item| item['data']['title'] }.flatten
238
+ .should include "Star Wars: Episode II - Attack of the Clones"
239
+ end
240
+ end
241
+
242
+ it "returns second page" do
243
+ VCR.use_cassette "search/request/paginated_second_page" do
244
+ searcher.with_items_per_page(4)
245
+ searcher.at_page(2)
246
+ resp = searcher.search
247
+ resp.results.map{ |item| item['data']['title'] }.flatten
248
+ .should include "Star Wars: Episode III - Revenge of the Sith"
249
+ end
250
+ end
251
+ end
252
+ end
253
+ end
254
+
@@ -0,0 +1 @@
1
+ {"rank":"-text_relevance","match-expr":"(label 'star wars')","hits":{"found":7,"start":0,"hit":[{"id":"tt1185834","data":{"actor":["Abercrombie, Ian","Baker, Dee Bradley","Burton, Corey","Eckstein, Ashley","Futterman, Nika","Kane, Tom","Lanter, Matt","Taber, Catherine","Taylor, James Arnold","Wood, Matthew"],"director":["Filoni, Dave"],"text_relevance":["308"],"title":["Star Wars: The Clone Wars"],"year":["2008"]}},{"id":"tt0076759","data":{"actor":["Baker, Kenny","Cushing, Peter","Daniels, Anthony","De Aragon, Maria","Diamond, Peter","Fisher, Carrie","Ford, Harrison","Goffe, Rusty","Guinness, Alec","Hamill, Mark","Johnston, Joe","Jones, James Earl","Lyons, Derek","Mayhew, Peter","McCallum, Rick","Prowse, David","Rimmer, Shane","Tierney, Malcolm","Tippett, Phil","Ward, Larry"],"director":["Lucas, George"],"text_relevance":["271"],"title":["Star Wars"],"year":["1977"]}},{"id":"tt0121765","data":{"actor":["Allen, Amy","August, Pernilla","Christensen, Hayden","Csokas, Marton","Fantl, Nicole","Jackson, Samuel L.","Johnson, Fiona","Lee, Christopher","Logan, Daniel","Lucas, Amanda","Lucas, Jett","Lucas, Katie","McDiarmid, Ian","McGregor, Ewan","Morrison, Temuera","Oz, Frank","Portman, Natalie","Smits, Jimmy","Thompson, Jack","Wood, Matthew"],"director":["Lucas, George"],"text_relevance":["269"],"title":["Star Wars: Episode II - Attack of the Clones"],"year":["2002"]}},{"id":"tt0080684","data":{"actor":["Anderson, Bob","Baker, Kenny","Bonehill, Richard","Capri, Mark","Daniels, Anthony","Diamond, Peter","Fisher, Carrie","Ford, Harrison","Guinness, Alec","Hamill, Mark","Jones, James Earl","Mayhew, Peter","McQuarrie, Ralph","Morse, Ralph","Oz, Frank","Prowse, David","Santiago, Michael","Williams, Billy Dee","Williams, Treat","Wingreen, Jason"],"director":["Kershner, Irvin"],"text_relevance":["268"],"title":["Star Wars: Episode V - The Empire Strikes Back"],"year":["1980"]}},{"id":"tt0086190","data":{"actor":["Altman, John","Bonehill, Richard","Brooke, Paul","Burtt, Ben","Daniels, Anthony","Diamond, Peter","Fisher, Carrie","Ford, Harrison","Hamill, Mark","Jones, James Earl","Marquand, Richard","Mayhew, Peter","McDiarmid, Ian","McRae, Hilton","Oz, Frank","Roy, Deep","Shaw, Sebastian","Ward, Larry","Welsh, Pat","Williams, Billy Dee"],"director":["Marquand, Richard"],"text_relevance":["268"],"title":["Star Wars: Episode VI - Return of the Jedi"],"year":["1983"]}},{"id":"tt0120915","data":{"actor":["Armitage, Richard","August, Pernilla","Best, Ahmed","Burtt, Ben","Chiang, Doug","Coppola, Roman","Daniels, Anthony","Ford Davies, Oliver","Hamill, Nathan","Knoll, John","Lau, Kamay","Lloyd, Jake","McCallum, Rick","McDiarmid, Ian","McGregor, Ewan","Menezes, Joo Costa","Neeson, Liam","Portman, Natalie","Quarshie, Hugh","Wood, Matthew"],"director":["Lucas, George"],"text_relevance":["268"],"title":["Star Wars: Episode I - The Phantom Menace"],"year":["1999"]}},{"id":"tt0121766","data":{"actor":["Bai, Ling","Bryant, Gene","Castle-Hughes, Keisha","Christensen, Hayden","Cooke, Ben","Daniels, Anthony","Jackson, Samuel L.","Jones, James Earl","Knoll, John","Lee, Christopher","Lucas, George","McDiarmid, Ian","McGregor, Ewan","Oz, Frank","Portman, Natalie","Smits, Jimmy","Spence, Paul","Steen, Suzie","Yamaguchi, Masa","de Souza Correa, Caroline"],"director":["Lucas, George"],"text_relevance":["266"],"title":["Star Wars: Episode III - Revenge of the Sith"],"year":["2005"]}}]},"info":{"rid":"d1b8bf24ec64151ed54a357e94f64bd8b1dadc1d67f6f2dcbc042ac86407c68b91582fba82640f4d","time-ms":3,"cpu-time-ms":4},"facets":{"genre":{"constraints":[{"value":"Action", "count":7}, {"value":"Adventure", "count":7}, {"value":"Sci-Fi", "count":7}, {"value":"Fantasy", "count":5}, {"value":"Animation", "count":1}, {"value":"Family", "count":1}, {"value":"Thriller", "count":1}]}, "year":{"min":1977, "max":2008}}}
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://doc-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/documents/batch
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"type":"add","id":"678","version":1,"lang":"en","fields":{"actor":["Cassio
9
+ Marques","Willian Fernandes"],"director":["Lucas, George"],"title":"Troy Wars"}}]'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ response:
14
+ status:
15
+ code: 200
16
+ message: OK
17
+ headers:
18
+ !binary "Q29udGVudC1UeXBl":
19
+ - !binary |-
20
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
21
+ !binary "RGF0ZQ==":
22
+ - !binary |-
23
+ VHVlLCAxNiBPY3QgMjAxMiAxODowNzozOCBHTVQ=
24
+ !binary "U2VydmVy":
25
+ - !binary |-
26
+ U2VydmVy
27
+ !binary "Q29udGVudC1MZW5ndGg=":
28
+ - !binary |-
29
+ NDY=
30
+ !binary "Q29ubmVjdGlvbg==":
31
+ - !binary |-
32
+ Q2xvc2U=
33
+ body:
34
+ encoding: US-ASCII
35
+ string: ! '{"status": "success", "adds": 1, "deletes": 0}'
36
+ http_version:
37
+ recorded_at: Tue, 16 Oct 2012 18:07:42 GMT
38
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://doc-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/documents/batch
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"type":"add","id":"678","version":5,"lang":"en","fields":{"actor":["Cassio
9
+ Marques","Willian Fernandes"],"director":["Lucas, George"],"title":"Troy Wars"}},{"type":"add","id":"679","version":5,"lang":"en","fields":{"title":"Fight
10
+ Club"}},{"type":"add","id":"680","version":5,"lang":"en","fields":{"title":"Lord
11
+ of the Rings"}}]'
12
+ headers:
13
+ Content-Type:
14
+ - application/json
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: OK
19
+ headers:
20
+ !binary "Q29udGVudC1UeXBl":
21
+ - !binary |-
22
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
23
+ !binary "RGF0ZQ==":
24
+ - !binary |-
25
+ VHVlLCAxNiBPY3QgMjAxMiAxODoxMjo1NCBHTVQ=
26
+ !binary "U2VydmVy":
27
+ - !binary |-
28
+ U2VydmVy
29
+ !binary "Q29udGVudC1MZW5ndGg=":
30
+ - !binary |-
31
+ NDY=
32
+ !binary "Q29ubmVjdGlvbg==":
33
+ - !binary |-
34
+ Q2xvc2U=
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ! '{"status": "success", "adds": 3, "deletes": 0}'
38
+ http_version:
39
+ recorded_at: Tue, 16 Oct 2012 18:12:58 GMT
40
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://doc-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/documents/batch
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"type":"delete","id":"678","version":2}]'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ !binary "Q29udGVudC1UeXBl":
18
+ - !binary |-
19
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
20
+ !binary "RGF0ZQ==":
21
+ - !binary |-
22
+ VHVlLCAxNiBPY3QgMjAxMiAxODowODoxNyBHTVQ=
23
+ !binary "U2VydmVy":
24
+ - !binary |-
25
+ U2VydmVy
26
+ !binary "Q29udGVudC1MZW5ndGg=":
27
+ - !binary |-
28
+ NDY=
29
+ !binary "Q29ubmVjdGlvbg==":
30
+ - !binary |-
31
+ Q2xvc2U=
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ! '{"status": "success", "adds": 0, "deletes": 1}'
35
+ http_version:
36
+ recorded_at: Tue, 16 Oct 2012 18:08:20 GMT
37
+ recorded_with: VCR 2.2.5