gsa 0.9.1 → 0.10.0

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.
@@ -1 +1 @@
1
- ["53604", "53602", "53606", "53605", "59632", "55219", "54611", "36843", "7965", "36628", "7903", "836", "59464", "56304", "53618", "55252", "752", "8014", "8012", "6194", "8013", "63361", "36824", "54154", "10327", "8000", "36777", "71083", "36687", "36793", "7997", "8248", "59564", "1947", "53957", "56201", "56205", "56206", "61168", "88504", "7744", "8369", "70948", "71481", "7963", "557", "86102", "56199", "6200", "36757", "54713", "36756", "36685", "56045", "3122", "59349", "56084", "63329", "36758", "36837", "36838", "86100", "36835", "59457"]
1
+ ["7903", "836", "68999", "63598", "69030", "8248", "56304", "53618", "8014", "8012", "6194", "8013", "54154", "8000", "68579", "53604", "68840", "68843", "68846", "68841", "68848", "67202", "66890", "67214", "67209", "1947", "53602", "53606", "53605"]
data/lib/defaults.rb CHANGED
@@ -21,6 +21,7 @@ module Defaults
21
21
  DEFAULT_OUTPUT = "xml_no_dtd" # OPTIONS: xml_no_dtd, xml
22
22
  DEFAULT_START = "0" # OPTIONS: 0..max_search_results
23
23
  DEFAULT_CLIENT = "default_frontend"
24
+ DEFAULT_COLLECTION = "default_collection" # maps to 'site'
24
25
  NO_RESULTS = 0
25
26
 
26
27
  # values for making xml files
data/lib/gsa/searcher.rb CHANGED
@@ -2,16 +2,17 @@ module GSA
2
2
  class Searcher
3
3
  def self.search(query, args={})
4
4
  query = clean_query(query)
5
- filter = args[:filter] || GSA::DEFAULT_FILTER
6
- getfields = args[:getfields] || GSA::DEFAULT_GETFIELDS
7
- sort = args[:sort] || GSA::DEFAULT_SORT
8
- num = args[:num] || GSA::DEFAULT_NUM
9
- output = args[:output] || GSA::DEFAULT_OUTPUT
10
- start = args[:start] || GSA::DEFAULT_START
11
- client = args[:client] || GSA::DEFAULT_CLIENT
12
- requiredfields = args[:filters] || nil
5
+ filter = args[:filter] || GSA::DEFAULT_FILTER
6
+ getfields = args[:getfields] || GSA::DEFAULT_GETFIELDS
7
+ sort = args[:sort] || GSA::DEFAULT_SORT
8
+ num = args[:num] || GSA::DEFAULT_NUM
9
+ output = args[:output] || GSA::DEFAULT_OUTPUT
10
+ start = args[:start] || GSA::DEFAULT_START
11
+ client = args[:client] || GSA::DEFAULT_CLIENT
12
+ site = args[:collection] || GSA::DEFAULT_COLLECTION
13
+ requiredfields = args[:filters] || nil
13
14
 
14
- search = "#{GSA.base_uri}/search?q=#{query}&filter=#{filter}&getfields=#{getfields}&sort=#{sort}&num=#{num}&start=#{start}&output=#{output}&client=#{client}"
15
+ search = "#{GSA.base_uri}/search?q=#{query}&filter=#{filter}&site=#{site}&getfields=#{getfields}&sort=#{sort}&num=#{num}&start=#{start}&output=#{output}&client=#{client}"
15
16
  search = "#{search}&requiredfields=#{clean_query(requiredfields)}" if requiredfields
16
17
 
17
18
  search_results = parsed_json( RestClient.get(search) )
data/lib/gsa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GSA
2
- VERSION = "0.9.1"
2
+ VERSION = "0.10.0"
3
3
  end
data/spec/fixtures.rb CHANGED
@@ -60,7 +60,7 @@ module Fixtures
60
60
  end
61
61
 
62
62
  def gsa_base_uri
63
- "http://dev-gsa.1000bulbs.com"
63
+ "https://dev-gsa.1000bulbs.com"
64
64
  end
65
65
 
66
66
  #######
data/spec/lib/gsa_spec.rb CHANGED
@@ -20,7 +20,7 @@ describe GSA do
20
20
  :records => many_records,
21
21
  :searchable => [:name, :description],
22
22
  :datasource_name => "products",
23
- :datasource_uri => "http://0.0.0.0:3000/products",
23
+ :datasource_uri => "https://0.0.0.0:3000/products",
24
24
  :datasource_uid => "id"
25
25
  )
26
26
  results.should eq success_text
@@ -37,7 +37,7 @@ describe GSA do
37
37
  :records => many_records,
38
38
  :searchable => [:name, :description],
39
39
  :datasource_name => "products",
40
- :datasource_uri => "http://0.0.0.0:3000/products",
40
+ :datasource_uri => "https://0.0.0.0:3000/products",
41
41
  :datasource_uid => "id"
42
42
  )
43
43
  results.should eq success_text
@@ -57,7 +57,7 @@ describe GSA do
57
57
  :records => many_records,
58
58
  :searchable => [:name, :description],
59
59
  :datasource_name => "products",
60
- :datasource_uri => "http://0.0.0.0:3000/products",
60
+ :datasource_uri => "https://0.0.0.0:3000/products",
61
61
  :datasource_uid => "id",
62
62
  :delete? => true
63
63
  )
@@ -75,7 +75,7 @@ describe GSA do
75
75
  :records => one_records,
76
76
  :searchable => [:name, :description],
77
77
  :datasource_name => "products",
78
- :datasource_uri => "http://0.0.0.0:3000/products",
78
+ :datasource_uri => "https://0.0.0.0:3000/products",
79
79
  :datasource_uid => "id",
80
80
  :delete? => true
81
81
  )
@@ -98,7 +98,7 @@ describe GSA do
98
98
  :records => one_records,
99
99
  :searchable => [:name, :description],
100
100
  :datasource_name => "products",
101
- :datasource_uri => "http://0.0.0.0:3000/products",
101
+ :datasource_uri => "https://0.0.0.0:3000/products",
102
102
  :datasource_uid => "id",
103
103
  :delete? => true
104
104
  )
@@ -134,28 +134,6 @@ describe GSA do
134
134
  end
135
135
  end
136
136
 
137
- context "with a query yielding a single match" do
138
-
139
- let(:query) { one_query }
140
- let(:result_set) { one_results }
141
-
142
- it "returns a single record" do
143
-
144
- VCR.use_cassette("single_result_no_filters") do
145
- results = GSA.search(query)
146
- results[:result_sets].count.should eq 1
147
- end
148
- end
149
-
150
- it "returns the single result in the expected 'pretty' format" do
151
-
152
- VCR.use_cassette("single_result_no_filters") do
153
- results = GSA.search(query)
154
- results[:result_sets].should eq result_set[:result_sets]
155
- end
156
- end
157
- end
158
-
159
137
  context "with a query yielding no matches" do
160
138
 
161
139
  let(:query) { none_query }
@@ -187,59 +165,6 @@ describe GSA do
187
165
  results[:result_sets].count.should be < results_set[:result_sets].count
188
166
  end
189
167
  end
190
-
191
- it "should only contain results matched in the unfiltered results" do
192
-
193
- VCR.use_cassette("many_results_with_filters") do
194
- results = GSA.search(query, :filters => filters)
195
-
196
- filtered_results = []
197
- results_set[:result_sets].each {|result|
198
- result[:metatags].each {|tag|
199
- if tag[:meta_name] == filter_name && tag[:meta_value] == filter_value
200
- filtered_results << result
201
- end
202
- }
203
- }
204
-
205
- result_uids = GSA.uids(results[:result_sets], uid)
206
- filtered_uids = GSA.uids(filtered_results, uid)
207
- result_uids.should eq filtered_uids
208
- end
209
- end
210
- end
211
-
212
- context "with a query yielding a single result" do
213
-
214
- let(:query) { many_query }
215
- let(:results_set) { many_results }
216
- let(:filter_1_name) { "attribute_color" }
217
- let(:filter_1_value) { "Red" }
218
- let(:filter_2_name) { "attribute_brand" }
219
- let(:filter_2_value) { "Vickerman" }
220
- let(:filters) { "#{filter_1_name}:#{filter_1_value}.#{filter_2_name}:#{filter_2_value}" }
221
-
222
- it "returns a single filtered result" do
223
-
224
- VCR.use_cassette("single_result_with_filters") do
225
- results = GSA.search(query, :filters => filters)
226
- results[:result_sets].count.should eq 1
227
- end
228
- end
229
-
230
- it "returns a result with the expected matching filters" do
231
-
232
- VCR.use_cassette("single_result_with_filters") do
233
- results = GSA.search(query, :filters => filters)
234
-
235
- results[:result_sets].each.inject([]) {|flags, result| result[:metatags].each {|tag|
236
- flags << 1 if tag[:meta_name] == filter_1_name && tag[:meta_value] == filter_1_value
237
- flags << 1 if tag[:meta_name] == filter_2_name && tag[:meta_value] == filter_2_value
238
- }
239
- flags
240
- }.should eq [1, 1]
241
- end
242
- end
243
168
  end
244
169
 
245
170
  context "with a query yielding no results" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Long
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-03 00:00:00.000000000 Z
12
+ date: 2014-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler