cloud_search 0.0.6 → 0.0.7
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.
- data/lib/cloud_search/search_response.rb +2 -1
- data/lib/cloud_search/searcher.rb +13 -11
- data/lib/cloud_search/version.rb +1 -1
- data/spec/cloud_search/search_response_spec.rb +39 -31
- data/spec/cloud_search/searcher_spec.rb +49 -19
- data/spec/fixtures/full.json +1 -0
- data/spec/fixtures/vcr_cassettes/search/request/paginated.yml +36 -0
- data/spec/fixtures/vcr_cassettes/search/request/paginated_first_page.yml +56 -0
- data/spec/fixtures/vcr_cassettes/search/request/paginated_second_page.yml +48 -0
- metadata +10 -4
- data/spec/fixtures/full.yml +0 -218
@@ -16,7 +16,7 @@ module CloudSearch
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def body=(body)
|
19
|
-
@body = body || {}
|
19
|
+
@body = JSON.parse(body || "{}")
|
20
20
|
calculate_pages
|
21
21
|
@body
|
22
22
|
end
|
@@ -27,6 +27,7 @@ module CloudSearch
|
|
27
27
|
|
28
28
|
alias :page_size :items_per_page
|
29
29
|
alias :total_entries :hits
|
30
|
+
alias :any? :found?
|
30
31
|
|
31
32
|
attr_writer :items_per_page
|
32
33
|
attr_reader :current_page
|
@@ -4,15 +4,16 @@ module CloudSearch
|
|
4
4
|
class Searcher
|
5
5
|
include ConfigurationChecking
|
6
6
|
|
7
|
-
def
|
8
|
-
response
|
7
|
+
def initialize
|
8
|
+
@response = SearchResponse.new
|
9
|
+
end
|
9
10
|
|
11
|
+
def search
|
10
12
|
cloud_search_response = RestClient.get url
|
11
|
-
response.http_code = cloud_search_response.code
|
12
|
-
response.body =
|
13
|
+
@response.http_code = cloud_search_response.code
|
14
|
+
@response.body = cloud_search_response.body
|
13
15
|
|
14
|
-
response
|
15
|
-
response
|
16
|
+
@response
|
16
17
|
end
|
17
18
|
|
18
19
|
def with_query(query)
|
@@ -27,7 +28,8 @@ module CloudSearch
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def query
|
30
|
-
|
31
|
+
return '' unless @query
|
32
|
+
URI.escape(@query).gsub('&', '%26')
|
31
33
|
end
|
32
34
|
|
33
35
|
def boolean_query?
|
@@ -40,16 +42,16 @@ module CloudSearch
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def with_items_per_page(items_per_page)
|
43
|
-
@items_per_page = items_per_page
|
45
|
+
@response.items_per_page = items_per_page
|
44
46
|
self
|
45
47
|
end
|
46
48
|
|
47
49
|
def items_per_page
|
48
|
-
@items_per_page
|
50
|
+
@response.items_per_page
|
49
51
|
end
|
50
52
|
|
51
53
|
def at_page(page)
|
52
|
-
@page_number = (page && page <
|
54
|
+
@page_number = (page && page < 0) ? 1 : page
|
53
55
|
self
|
54
56
|
end
|
55
57
|
|
@@ -59,7 +61,7 @@ module CloudSearch
|
|
59
61
|
|
60
62
|
def start
|
61
63
|
return 0 if page_number <= 1
|
62
|
-
(items_per_page * page_number
|
64
|
+
(items_per_page * (page_number - 1)) + 1
|
63
65
|
end
|
64
66
|
|
65
67
|
def url
|
data/lib/cloud_search/version.rb
CHANGED
@@ -5,7 +5,7 @@ describe CloudSearch::SearchResponse do
|
|
5
5
|
|
6
6
|
context "when there are results" do
|
7
7
|
before do
|
8
|
-
subject.body =
|
8
|
+
subject.body = File.read File.expand_path("../../fixtures/full.json", __FILE__)
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#results" do
|
@@ -39,6 +39,12 @@ describe CloudSearch::SearchResponse do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
describe "#any?" do
|
43
|
+
it "returns true when has found results" do
|
44
|
+
subject.should be_any
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
42
48
|
describe "#items_per_page" do
|
43
49
|
it "returns items per page as default 10" do
|
44
50
|
subject.items_per_page.should == 10
|
@@ -60,7 +66,7 @@ describe CloudSearch::SearchResponse do
|
|
60
66
|
|
61
67
|
context "when there aren't results" do
|
62
68
|
before do
|
63
|
-
subject.body = {}
|
69
|
+
subject.body = "{}"
|
64
70
|
end
|
65
71
|
|
66
72
|
describe "#results" do
|
@@ -101,7 +107,9 @@ describe CloudSearch::SearchResponse do
|
|
101
107
|
end
|
102
108
|
|
103
109
|
context "pagination" do
|
104
|
-
let(:seven_hits) {
|
110
|
+
let(:seven_hits) { File.read File.expand_path("../../fixtures/full.json", __FILE__) }
|
111
|
+
let(:seven_hits_hash) { JSON.parse(seven_hits) }
|
112
|
+
|
105
113
|
|
106
114
|
it "returns number of pages based on hits" do
|
107
115
|
subject.items_per_page = 8
|
@@ -139,75 +147,75 @@ describe CloudSearch::SearchResponse do
|
|
139
147
|
|
140
148
|
it "returns current page based on start and items per page" do
|
141
149
|
subject.items_per_page = 3
|
142
|
-
|
143
|
-
subject.body =
|
150
|
+
seven_hits_hash['hits']['start'] = nil
|
151
|
+
subject.body = seven_hits_hash.to_json
|
144
152
|
subject.current_page.should == 1
|
145
153
|
|
146
154
|
subject.items_per_page = 3
|
147
|
-
|
148
|
-
subject.body =
|
155
|
+
seven_hits_hash['hits']['start'] = 0
|
156
|
+
subject.body = seven_hits_hash.to_json
|
149
157
|
subject.current_page.should == 1
|
150
158
|
|
151
159
|
subject.items_per_page = 3
|
152
|
-
|
153
|
-
subject.body =
|
160
|
+
seven_hits_hash['hits']['start'] = 2
|
161
|
+
subject.body = seven_hits_hash.to_json
|
154
162
|
subject.current_page.should == 1
|
155
163
|
|
156
164
|
subject.items_per_page = 3
|
157
|
-
|
158
|
-
subject.body =
|
165
|
+
seven_hits_hash['hits']['start'] = 3
|
166
|
+
subject.body = seven_hits_hash.to_json
|
159
167
|
subject.current_page.should == 2
|
160
168
|
|
161
169
|
subject.items_per_page = 3
|
162
|
-
|
163
|
-
subject.body =
|
170
|
+
seven_hits_hash['hits']['start'] = 4
|
171
|
+
subject.body = seven_hits_hash.to_json
|
164
172
|
subject.current_page.should == 2
|
165
173
|
|
166
174
|
subject.items_per_page = 3
|
167
|
-
|
168
|
-
subject.body =
|
175
|
+
seven_hits_hash['hits']['start'] = 5
|
176
|
+
subject.body = seven_hits_hash.to_json
|
169
177
|
subject.current_page.should == 2
|
170
178
|
|
171
179
|
subject.items_per_page = 3
|
172
|
-
|
173
|
-
subject.body =
|
180
|
+
seven_hits_hash['hits']['start'] = 6
|
181
|
+
subject.body = seven_hits_hash.to_json
|
174
182
|
subject.current_page.should == 3
|
175
183
|
end
|
176
184
|
|
177
185
|
it "calculates offset based on current page and items_per_page" do
|
178
186
|
subject.items_per_page = 3
|
179
|
-
|
180
|
-
subject.body =
|
187
|
+
seven_hits_hash['hits']['start'] = nil
|
188
|
+
subject.body = seven_hits_hash.to_json
|
181
189
|
subject.offset.should == 0
|
182
190
|
|
183
191
|
subject.items_per_page = 3
|
184
|
-
|
185
|
-
subject.body =
|
192
|
+
seven_hits_hash['hits']['start'] = 0
|
193
|
+
subject.body = seven_hits_hash.to_json
|
186
194
|
subject.offset.should == 0
|
187
195
|
|
188
196
|
subject.items_per_page = 3
|
189
|
-
|
190
|
-
subject.body =
|
197
|
+
seven_hits_hash['hits']['start'] = 2
|
198
|
+
subject.body = seven_hits_hash.to_json
|
191
199
|
subject.offset.should == 0
|
192
200
|
|
193
201
|
subject.items_per_page = 3
|
194
|
-
|
195
|
-
subject.body =
|
202
|
+
seven_hits_hash['hits']['start'] = 3
|
203
|
+
subject.body = seven_hits_hash.to_json
|
196
204
|
subject.offset.should == 3
|
197
205
|
|
198
206
|
subject.items_per_page = 3
|
199
|
-
|
200
|
-
subject.body =
|
207
|
+
seven_hits_hash['hits']['start'] = 4
|
208
|
+
subject.body = seven_hits_hash.to_json
|
201
209
|
subject.offset.should == 3
|
202
210
|
|
203
211
|
subject.items_per_page = 3
|
204
|
-
|
205
|
-
subject.body =
|
212
|
+
seven_hits_hash['hits']['start'] = 5
|
213
|
+
subject.body = seven_hits_hash.to_json
|
206
214
|
subject.offset.should == 3
|
207
215
|
|
208
216
|
subject.items_per_page = 3
|
209
|
-
|
210
|
-
subject.body =
|
217
|
+
seven_hits_hash['hits']['start'] = 6
|
218
|
+
subject.body = seven_hits_hash.to_json
|
211
219
|
subject.offset.should == 6
|
212
220
|
end
|
213
221
|
end
|
@@ -111,7 +111,7 @@ describe CloudSearch::Searcher do
|
|
111
111
|
|
112
112
|
it "returns start index 19 for page 2" do
|
113
113
|
subject.at_page(2)
|
114
|
-
subject.start.should ==
|
114
|
+
subject.start.should == 11
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -137,7 +137,7 @@ describe CloudSearch::Searcher do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it "returns cloud search url with start at 19" do
|
140
|
-
subject.at_page(2).url.should == "#{url_prefix}q=&size=10&start=
|
140
|
+
subject.at_page(2).url.should == "#{url_prefix}q=&size=10&start=11"
|
141
141
|
end
|
142
142
|
|
143
143
|
it "returns cloud search url with foo and bar fields" do
|
@@ -152,8 +152,6 @@ describe CloudSearch::Searcher do
|
|
152
152
|
.with_query("star wars")
|
153
153
|
end
|
154
154
|
|
155
|
-
around { |example| VCR.use_cassette "search/request/full", &example }
|
156
|
-
|
157
155
|
context "when the domain id was not configured" do
|
158
156
|
around do |example|
|
159
157
|
domain_id = CloudSearch.config.domain_id
|
@@ -184,25 +182,57 @@ describe CloudSearch::Searcher do
|
|
184
182
|
end
|
185
183
|
end
|
186
184
|
|
187
|
-
|
188
|
-
|
189
|
-
resp.http_code.should == 200
|
190
|
-
end
|
185
|
+
context "when search" do
|
186
|
+
around { |example| VCR.use_cassette "search/request/full", &example }
|
191
187
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
188
|
+
it "returns http 200 code" do
|
189
|
+
resp = subject.search
|
190
|
+
resp.http_code.should == 200
|
191
|
+
end
|
192
|
+
|
193
|
+
it "has found results" do
|
194
|
+
resp = subject.search
|
195
|
+
resp.should be_found
|
196
|
+
end
|
197
|
+
|
198
|
+
it "returns number of hits" do
|
199
|
+
resp = subject.search
|
200
|
+
expect(resp.hits).to be == 7
|
201
|
+
end
|
196
202
|
|
197
|
-
|
198
|
-
|
199
|
-
|
203
|
+
it "returns Episode II" do
|
204
|
+
resp = subject.search
|
205
|
+
resp.results.map{ |item| item['data']['title'] }.flatten
|
206
|
+
.should include "Star Wars: Episode II - Attack of the Clones"
|
207
|
+
end
|
200
208
|
end
|
209
|
+
context "when paginate result" do
|
210
|
+
before do
|
211
|
+
subject
|
212
|
+
.with_fields(:actor, :director, :title, :year, :text_relevance)
|
213
|
+
.with_query("star wars")
|
214
|
+
end
|
215
|
+
|
201
216
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
217
|
+
it "returns first page" do
|
218
|
+
VCR.use_cassette "search/request/paginated_first_page" do
|
219
|
+
subject.with_items_per_page(4)
|
220
|
+
subject.at_page(1)
|
221
|
+
resp = subject.search
|
222
|
+
resp.results.map{ |item| item['data']['title'] }.flatten
|
223
|
+
.should include "Star Wars: Episode II - Attack of the Clones"
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
it "returns second page" do
|
228
|
+
VCR.use_cassette "search/request/paginated_second_page" do
|
229
|
+
subject.with_items_per_page(4)
|
230
|
+
subject.at_page(2)
|
231
|
+
resp = subject.search
|
232
|
+
resp.results.map{ |item| item['data']['title'] }.flatten
|
233
|
+
.should include "Star Wars: Episode III - Revenge of the Sith"
|
234
|
+
end
|
235
|
+
end
|
206
236
|
end
|
207
237
|
end
|
208
238
|
end
|
@@ -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}}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://search-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=star%20wars&return-fields=actor,director,title,year,text_relevance&size=5&start=9
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Date:
|
24
|
+
- Fri, 19 Oct 2012 12:47:19 GMT
|
25
|
+
Server:
|
26
|
+
- Server
|
27
|
+
Content-Length:
|
28
|
+
- '225'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: US-ASCII
|
33
|
+
string: ! '{"rank":"-text_relevance","match-expr":"(label ''star wars'')","hits":{"found":7,"start":9,"hit":[]},"info":{"rid":"d1b8bf24ec64151ef1900a937725719e149e6144919d6bc4d8af3b182ca0713fcaadee41aee65029","time-ms":3,"cpu-time-ms":0}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 19 Oct 2012 12:47:24 GMT
|
36
|
+
recorded_with: VCR 2.2.4
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://search-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=star%20wars&return-fields=actor,director,title,year,text_relevance&size=4&start=0
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Date:
|
24
|
+
- Fri, 19 Oct 2012 12:54:26 GMT
|
25
|
+
Server:
|
26
|
+
- Server
|
27
|
+
Content-Length:
|
28
|
+
- '2025'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: US-ASCII
|
33
|
+
string: ! '{"rank":"-text_relevance","match-expr":"(label ''star wars'')","hits":{"found":7,"start":0,"hit":[{"id":"tt1185834","data":{"actor":["Abercrombie,
|
34
|
+
Ian","Baker, Dee Bradley","Burton, Corey","Eckstein, Ashley","Futterman, Nika","Kane,
|
35
|
+
Tom","Lanter, Matt","Taber, Catherine","Taylor, James Arnold","Wood, Matthew"],"director":["Filoni,
|
36
|
+
Dave"],"text_relevance":["307"],"title":["Star Wars: The Clone Wars"],"year":["2008"]}},{"id":"tt0076759","data":{"actor":["Baker,
|
37
|
+
Kenny","Cushing, Peter","Daniels, Anthony","De Aragon, Maria","Diamond, Peter","Fisher,
|
38
|
+
Carrie","Ford, Harrison","Goffe, Rusty","Guinness, Alec","Hamill, Mark","Johnston,
|
39
|
+
Joe","Jones, James Earl","Lyons, Derek","Mayhew, Peter","McCallum, Rick","Prowse,
|
40
|
+
David","Rimmer, Shane","Tierney, Malcolm","Tippett, Phil","Ward, Larry"],"director":["Lucas,
|
41
|
+
George"],"text_relevance":["270"],"title":["Star Wars"],"year":["1977"]}},{"id":"tt0121765","data":{"actor":["Allen,
|
42
|
+
Amy","August, Pernilla","Christensen, Hayden","Csokas, Marton","Fantl, Nicole","Jackson,
|
43
|
+
Samuel L.","Johnson, Fiona","Lee, Christopher","Logan, Daniel","Lucas, Amanda","Lucas,
|
44
|
+
Jett","Lucas, Katie","McDiarmid, Ian","McGregor, Ewan","Morrison, Temuera","Oz,
|
45
|
+
Frank","Portman, Natalie","Smits, Jimmy","Thompson, Jack","Wood, Matthew"],"director":["Lucas,
|
46
|
+
George"],"text_relevance":["269"],"title":["Star Wars: Episode II - Attack
|
47
|
+
of the Clones"],"year":["2002"]}},{"id":"tt0080684","data":{"actor":["Anderson,
|
48
|
+
Bob","Baker, Kenny","Bonehill, Richard","Capri, Mark","Daniels, Anthony","Diamond,
|
49
|
+
Peter","Fisher, Carrie","Ford, Harrison","Guinness, Alec","Hamill, Mark","Jones,
|
50
|
+
James Earl","Mayhew, Peter","McQuarrie, Ralph","Morse, Ralph","Oz, Frank","Prowse,
|
51
|
+
David","Santiago, Michael","Williams, Billy Dee","Williams, Treat","Wingreen,
|
52
|
+
Jason"],"director":["Kershner, Irvin"],"text_relevance":["268"],"title":["Star
|
53
|
+
Wars: Episode V - The Empire Strikes Back"],"year":["1980"]}}]},"info":{"rid":"d1b8bf24ec64151ef1900a937725719ec6661625fa5a3d78f6504f0c0ebd44595331de2b01a2900e","time-ms":3,"cpu-time-ms":0}}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Fri, 19 Oct 2012 12:54:31 GMT
|
56
|
+
recorded_with: VCR 2.2.4
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://search-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=star%20wars&return-fields=actor,director,title,year,text_relevance&size=4&start=5
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*; q=0.5, application/xml'
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Content-Type:
|
22
|
+
- application/json
|
23
|
+
Date:
|
24
|
+
- Fri, 19 Oct 2012 12:54:26 GMT
|
25
|
+
Server:
|
26
|
+
- Server
|
27
|
+
Content-Length:
|
28
|
+
- '1235'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: US-ASCII
|
33
|
+
string: ! '{"rank":"-text_relevance","match-expr":"(label ''star wars'')","hits":{"found":7,"start":5,"hit":[{"id":"tt0086190","data":{"actor":["Altman,
|
34
|
+
John","Bonehill, Richard","Brooke, Paul","Burtt, Ben","Daniels, Anthony","Diamond,
|
35
|
+
Peter","Fisher, Carrie","Ford, Harrison","Hamill, Mark","Jones, James Earl","Marquand,
|
36
|
+
Richard","Mayhew, Peter","McDiarmid, Ian","McRae, Hilton","Oz, Frank","Roy,
|
37
|
+
Deep","Shaw, Sebastian","Ward, Larry","Welsh, Pat","Williams, Billy Dee"],"director":["Marquand,
|
38
|
+
Richard"],"text_relevance":["268"],"title":["Star Wars: Episode VI - Return
|
39
|
+
of the Jedi"],"year":["1983"]}},{"id":"tt0121766","data":{"actor":["Bai, Ling","Bryant,
|
40
|
+
Gene","Castle-Hughes, Keisha","Christensen, Hayden","Cooke, Ben","Daniels,
|
41
|
+
Anthony","Jackson, Samuel L.","Jones, James Earl","Knoll, John","Lee, Christopher","Lucas,
|
42
|
+
George","McDiarmid, Ian","McGregor, Ewan","Oz, Frank","Portman, Natalie","Smits,
|
43
|
+
Jimmy","Spence, Paul","Steen, Suzie","Yamaguchi, Masa","de Souza Correa, Caroline"],"director":["Lucas,
|
44
|
+
George"],"text_relevance":["266"],"title":["Star Wars: Episode III - Revenge
|
45
|
+
of the Sith"],"year":["2005"]}}]},"info":{"rid":"d1b8bf24ec64151ef1900a937725719e16ef82997926220f8d083b43777b29a1e52ffa47d7196049","time-ms":3,"cpu-time-ms":0}}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Fri, 19 Oct 2012 12:54:31 GMT
|
48
|
+
recorded_with: VCR 2.2.4
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -153,11 +153,14 @@ files:
|
|
153
153
|
- spec/cloud_search/invalid_document_spec.rb
|
154
154
|
- spec/cloud_search/search_response_spec.rb
|
155
155
|
- spec/cloud_search/searcher_spec.rb
|
156
|
-
- spec/fixtures/full.
|
156
|
+
- spec/fixtures/full.json
|
157
157
|
- spec/fixtures/vcr_cassettes/index/request/add.yml
|
158
158
|
- spec/fixtures/vcr_cassettes/index/request/add_in_batch.yml
|
159
159
|
- spec/fixtures/vcr_cassettes/index/request/delete.yml
|
160
160
|
- spec/fixtures/vcr_cassettes/search/request/full.yml
|
161
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated.yml
|
162
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated_first_page.yml
|
163
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated_second_page.yml
|
161
164
|
- spec/spec_helper.rb
|
162
165
|
- spec/support/vcr.rb
|
163
166
|
homepage: http://rubygems.org/gems/cloud_search
|
@@ -191,11 +194,14 @@ test_files:
|
|
191
194
|
- spec/cloud_search/invalid_document_spec.rb
|
192
195
|
- spec/cloud_search/search_response_spec.rb
|
193
196
|
- spec/cloud_search/searcher_spec.rb
|
194
|
-
- spec/fixtures/full.
|
197
|
+
- spec/fixtures/full.json
|
195
198
|
- spec/fixtures/vcr_cassettes/index/request/add.yml
|
196
199
|
- spec/fixtures/vcr_cassettes/index/request/add_in_batch.yml
|
197
200
|
- spec/fixtures/vcr_cassettes/index/request/delete.yml
|
198
201
|
- spec/fixtures/vcr_cassettes/search/request/full.yml
|
202
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated.yml
|
203
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated_first_page.yml
|
204
|
+
- spec/fixtures/vcr_cassettes/search/request/paginated_second_page.yml
|
199
205
|
- spec/spec_helper.rb
|
200
206
|
- spec/support/vcr.rb
|
201
207
|
has_rdoc:
|
data/spec/fixtures/full.yml
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
---
|
2
|
-
rank: -text_relevance
|
3
|
-
match-expr: (label 'star wars')
|
4
|
-
hits:
|
5
|
-
found: 7
|
6
|
-
start: 0
|
7
|
-
hit:
|
8
|
-
- id: tt1185834
|
9
|
-
data:
|
10
|
-
actor:
|
11
|
-
- Abercrombie, Ian
|
12
|
-
- Baker, Dee Bradley
|
13
|
-
- Burton, Corey
|
14
|
-
- Eckstein, Ashley
|
15
|
-
- Futterman, Nika
|
16
|
-
- Kane, Tom
|
17
|
-
- Lanter, Matt
|
18
|
-
- Taber, Catherine
|
19
|
-
- Taylor, James Arnold
|
20
|
-
- Wood, Matthew
|
21
|
-
director:
|
22
|
-
- Filoni, Dave
|
23
|
-
text_relevance:
|
24
|
-
- '308'
|
25
|
-
title:
|
26
|
-
- ! 'Star Wars: The Clone Wars'
|
27
|
-
year:
|
28
|
-
- '2008'
|
29
|
-
- id: tt0076759
|
30
|
-
data:
|
31
|
-
actor:
|
32
|
-
- Baker, Kenny
|
33
|
-
- Cushing, Peter
|
34
|
-
- Daniels, Anthony
|
35
|
-
- De Aragon, Maria
|
36
|
-
- Diamond, Peter
|
37
|
-
- Fisher, Carrie
|
38
|
-
- Ford, Harrison
|
39
|
-
- Goffe, Rusty
|
40
|
-
- Guinness, Alec
|
41
|
-
- Hamill, Mark
|
42
|
-
- Johnston, Joe
|
43
|
-
- Jones, James Earl
|
44
|
-
- Lyons, Derek
|
45
|
-
- Mayhew, Peter
|
46
|
-
- McCallum, Rick
|
47
|
-
- Prowse, David
|
48
|
-
- Rimmer, Shane
|
49
|
-
- Tierney, Malcolm
|
50
|
-
- Tippett, Phil
|
51
|
-
- Ward, Larry
|
52
|
-
director:
|
53
|
-
- Lucas, George
|
54
|
-
text_relevance:
|
55
|
-
- '271'
|
56
|
-
title:
|
57
|
-
- Star Wars
|
58
|
-
year:
|
59
|
-
- '1977'
|
60
|
-
- id: tt0121765
|
61
|
-
data:
|
62
|
-
actor:
|
63
|
-
- Allen, Amy
|
64
|
-
- August, Pernilla
|
65
|
-
- Christensen, Hayden
|
66
|
-
- Csokas, Marton
|
67
|
-
- Fantl, Nicole
|
68
|
-
- Jackson, Samuel L.
|
69
|
-
- Johnson, Fiona
|
70
|
-
- Lee, Christopher
|
71
|
-
- Logan, Daniel
|
72
|
-
- Lucas, Amanda
|
73
|
-
- Lucas, Jett
|
74
|
-
- Lucas, Katie
|
75
|
-
- McDiarmid, Ian
|
76
|
-
- McGregor, Ewan
|
77
|
-
- Morrison, Temuera
|
78
|
-
- Oz, Frank
|
79
|
-
- Portman, Natalie
|
80
|
-
- Smits, Jimmy
|
81
|
-
- Thompson, Jack
|
82
|
-
- Wood, Matthew
|
83
|
-
director:
|
84
|
-
- Lucas, George
|
85
|
-
text_relevance:
|
86
|
-
- '269'
|
87
|
-
title:
|
88
|
-
- ! 'Star Wars: Episode II - Attack of the Clones'
|
89
|
-
year:
|
90
|
-
- '2002'
|
91
|
-
- id: tt0080684
|
92
|
-
data:
|
93
|
-
actor:
|
94
|
-
- Anderson, Bob
|
95
|
-
- Baker, Kenny
|
96
|
-
- Bonehill, Richard
|
97
|
-
- Capri, Mark
|
98
|
-
- Daniels, Anthony
|
99
|
-
- Diamond, Peter
|
100
|
-
- Fisher, Carrie
|
101
|
-
- Ford, Harrison
|
102
|
-
- Guinness, Alec
|
103
|
-
- Hamill, Mark
|
104
|
-
- Jones, James Earl
|
105
|
-
- Mayhew, Peter
|
106
|
-
- McQuarrie, Ralph
|
107
|
-
- Morse, Ralph
|
108
|
-
- Oz, Frank
|
109
|
-
- Prowse, David
|
110
|
-
- Santiago, Michael
|
111
|
-
- Williams, Billy Dee
|
112
|
-
- Williams, Treat
|
113
|
-
- Wingreen, Jason
|
114
|
-
director:
|
115
|
-
- Kershner, Irvin
|
116
|
-
text_relevance:
|
117
|
-
- '268'
|
118
|
-
title:
|
119
|
-
- ! 'Star Wars: Episode V - The Empire Strikes Back'
|
120
|
-
year:
|
121
|
-
- '1980'
|
122
|
-
- id: tt0086190
|
123
|
-
data:
|
124
|
-
actor:
|
125
|
-
- Altman, John
|
126
|
-
- Bonehill, Richard
|
127
|
-
- Brooke, Paul
|
128
|
-
- Burtt, Ben
|
129
|
-
- Daniels, Anthony
|
130
|
-
- Diamond, Peter
|
131
|
-
- Fisher, Carrie
|
132
|
-
- Ford, Harrison
|
133
|
-
- Hamill, Mark
|
134
|
-
- Jones, James Earl
|
135
|
-
- Marquand, Richard
|
136
|
-
- Mayhew, Peter
|
137
|
-
- McDiarmid, Ian
|
138
|
-
- McRae, Hilton
|
139
|
-
- Oz, Frank
|
140
|
-
- Roy, Deep
|
141
|
-
- Shaw, Sebastian
|
142
|
-
- Ward, Larry
|
143
|
-
- Welsh, Pat
|
144
|
-
- Williams, Billy Dee
|
145
|
-
director:
|
146
|
-
- Marquand, Richard
|
147
|
-
text_relevance:
|
148
|
-
- '268'
|
149
|
-
title:
|
150
|
-
- ! 'Star Wars: Episode VI - Return of the Jedi'
|
151
|
-
year:
|
152
|
-
- '1983'
|
153
|
-
- id: tt0120915
|
154
|
-
data:
|
155
|
-
actor:
|
156
|
-
- Armitage, Richard
|
157
|
-
- August, Pernilla
|
158
|
-
- Best, Ahmed
|
159
|
-
- Burtt, Ben
|
160
|
-
- Chiang, Doug
|
161
|
-
- Coppola, Roman
|
162
|
-
- Daniels, Anthony
|
163
|
-
- Ford Davies, Oliver
|
164
|
-
- Hamill, Nathan
|
165
|
-
- Knoll, John
|
166
|
-
- Lau, Kamay
|
167
|
-
- Lloyd, Jake
|
168
|
-
- McCallum, Rick
|
169
|
-
- McDiarmid, Ian
|
170
|
-
- McGregor, Ewan
|
171
|
-
- Menezes, João Costa
|
172
|
-
- Neeson, Liam
|
173
|
-
- Portman, Natalie
|
174
|
-
- Quarshie, Hugh
|
175
|
-
- Wood, Matthew
|
176
|
-
director:
|
177
|
-
- Lucas, George
|
178
|
-
text_relevance:
|
179
|
-
- '268'
|
180
|
-
title:
|
181
|
-
- ! 'Star Wars: Episode I - The Phantom Menace'
|
182
|
-
year:
|
183
|
-
- '1999'
|
184
|
-
- id: tt0121766
|
185
|
-
data:
|
186
|
-
actor:
|
187
|
-
- Bai, Ling
|
188
|
-
- Bryant, Gene
|
189
|
-
- Castle-Hughes, Keisha
|
190
|
-
- Christensen, Hayden
|
191
|
-
- Cooke, Ben
|
192
|
-
- Daniels, Anthony
|
193
|
-
- Jackson, Samuel L.
|
194
|
-
- Jones, James Earl
|
195
|
-
- Knoll, John
|
196
|
-
- Lee, Christopher
|
197
|
-
- Lucas, George
|
198
|
-
- McDiarmid, Ian
|
199
|
-
- McGregor, Ewan
|
200
|
-
- Oz, Frank
|
201
|
-
- Portman, Natalie
|
202
|
-
- Smits, Jimmy
|
203
|
-
- Spence, Paul
|
204
|
-
- Steen, Suzie
|
205
|
-
- Yamaguchi, Masa
|
206
|
-
- de Souza Correa, Caroline
|
207
|
-
director:
|
208
|
-
- Lucas, George
|
209
|
-
text_relevance:
|
210
|
-
- '266'
|
211
|
-
title:
|
212
|
-
- ! 'Star Wars: Episode III - Revenge of the Sith'
|
213
|
-
year:
|
214
|
-
- '2005'
|
215
|
-
info:
|
216
|
-
rid: d1b8bf24ec64151ed54a357e94f64bd8b1dadc1d67f6f2dcbc042ac86407c68b91582fba82640f4d
|
217
|
-
time-ms: 3
|
218
|
-
cpu-time-ms: 4
|