ansr_blacklight 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDk3NWUxNDFiNTdiYWY1MjU1Y2E3NzA4MWFmNTE4NDZkNzQ5NDg1MQ==
4
+ YTJjYWIyMDhiNWVlNzNiYmRmNGFiMzdkMWQ3MTEyMDc0YmRiOTRmZQ==
5
5
  data.tar.gz: !binary |-
6
- NjM0ZWI5NjhkMTIwNGIxYTJiMmQyNDVlMmVhM2I1ODNhMzYyYjE3YQ==
6
+ ZGQ3NDNkN2YzYzM4OTRiMDc3YWVlOGY2NGQwN2NmMjI2NzU2MWRkNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDcxMjYzZTA1MzliMThmOWFhYzk4YTQ2MWRmODIxZmM3MWNlZWQxOTQ1NjZm
10
- ZDU5N2ExODMxMTczZWE3NWFhMjg5YjNjOTI0ZWE5YjgwZDE0MGRkZGM3OTlk
11
- OGM1ZGMzZjUxNjQ5MWNkN2Q1ODc2ZDNlNTY4M2U3YjcxNDU2Mjg=
9
+ MWU2ZTEyMTNiOTIzNDU3ZjA5YTY4NmU1NTA0MGQ2OGMxNDRhMTJkYzgyYTk4
10
+ ZjYzNjIzNzgwNTMyMjZmMTQyNjI0Y2RlZDQ4ODc3YTE4MThhOTI5Yjc1OTY3
11
+ YmIyYWYyNGZlNWRkMDcxYWIxMjQ0MTY0YWE4YWViNWZhOGRiOTQ=
12
12
  data.tar.gz: !binary |-
13
- M2MxNDgxMjE3YWIxMjc0MmY3NzBkYjg1YWMxMTMyZjUwNDIyZDAxMzA2NGY0
14
- NWQwYzI0Y2MzYzY2MjU5ZmJmZWY4NzA4OWEwNjMzMDQ2MTU5ZWNmZTgwNDJi
15
- NTA1OGZjYzE0NWY2YWUwY2NhZGIyNDk2MzYzMDIyY2M3MjIwMWE=
13
+ ZTIyNTdhOGI0OThmYjUyMjFiODgxMTdjZGRkY2Y5NjE3NjQ4NzFiM2EyNGI4
14
+ Yjg3YWNjYjYxNDUxNDE4Zjc5YmQ2YjlmMDlmZGVjMDBkZTkxNmE4NGMwNjFh
15
+ NmRiYzE3ZWMwODhmMjU0MzA1MTU1ODkzNzZiMzU2YTNlODFlNDk=
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.add_dependency 'rest-client'
20
20
  spec.add_dependency 'loggable'
21
21
  spec.add_dependency "rails", ">= 3.2.6", "< 5"
22
- # spec.add_dependency 'blacklight', '>=5.1.0'
22
+ spec.add_dependency "rsolr", "~> 1.0.6" # Library for interacting with rSolr.
23
+ spec.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results
23
24
  spec.add_dependency 'sass-rails'
24
25
  spec.add_development_dependency("rake")
25
26
  spec.add_development_dependency("bundler", ">= 1.0.14")
@@ -46,5 +46,14 @@ module Ansr::Blacklight
46
46
  end
47
47
  arel
48
48
  end
49
+
50
+ def grouped?
51
+ loaded? ? response.grouped? : !group_values.blank?
52
+ end
53
+
54
+ def group_by(key=self.group_values.first)
55
+ loaded
56
+ response.grouped(model()).select { |x| x.key == key.to_s }
57
+ end
49
58
  end
50
59
  end
@@ -4,7 +4,7 @@ describe Ansr::Blacklight::Relation do
4
4
 
5
5
  def create_response
6
6
  raw_response = eval(mock_query_response)
7
- Blacklight::SolrResponse.new(raw_response, raw_response['params'])
7
+ Ansr::Blacklight::Solr::Response.new(raw_response, raw_response['params'])
8
8
  end
9
9
 
10
10
  def stub_solr
@@ -133,64 +133,64 @@ describe Ansr::Blacklight::Relation do
133
133
  it 'should provide the responseHeader params' do
134
134
  raw_response = eval(mock_query_response)
135
135
  raw_response['responseHeader']['params']['test'] = :test
136
- r = Blacklight::SolrResponse.new(raw_response, raw_response['params'])
136
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, raw_response['params'])
137
137
  r.params['test'].should == :test
138
138
  end
139
139
 
140
140
  it 'should provide the solr-returned params and "rows" should be 11' do
141
141
  raw_response = eval(mock_query_response)
142
- r = Blacklight::SolrResponse.new(raw_response, {})
142
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
143
143
  r.params[:rows].to_s.should == '11'
144
144
  end
145
145
 
146
146
  it 'should provide the ruby request params if responseHeader["params"] does not exist' do
147
147
  raw_response = eval(mock_query_response)
148
148
  raw_response.delete 'responseHeader'
149
- r = Blacklight::SolrResponse.new(raw_response, :rows => 999)
149
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, :rows => 999)
150
150
  r.params[:rows].to_s.should == '999'
151
151
  end
152
152
 
153
153
  it 'should provide spelling suggestions for regular spellcheck results' do
154
154
  raw_response = eval(mock_response_with_spellcheck)
155
- r = Blacklight::SolrResponse.new(raw_response, {})
155
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
156
156
  r.spelling.words.should include("dell")
157
157
  r.spelling.words.should include("ultrasharp")
158
158
  end
159
159
 
160
160
  it 'should provide spelling suggestions for extended spellcheck results' do
161
161
  raw_response = eval(mock_response_with_spellcheck_extended)
162
- r = Blacklight::SolrResponse.new(raw_response, {})
162
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
163
163
  r.spelling.words.should include("dell")
164
164
  r.spelling.words.should include("ultrasharp")
165
165
  end
166
166
 
167
167
  it 'should provide no spelling suggestions when extended results and suggestion frequency is the same as original query frequency' do
168
168
  raw_response = eval(mock_response_with_spellcheck_same_frequency)
169
- r = Blacklight::SolrResponse.new(raw_response, {})
169
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
170
170
  r.spelling.words.should == []
171
171
  end
172
172
 
173
173
  it 'should provide spelling suggestions for a regular spellcheck results with a collation' do
174
174
  raw_response = eval(mock_response_with_spellcheck_collation)
175
- r = Blacklight::SolrResponse.new(raw_response, {})
175
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
176
176
  r.spelling.words.should include("dell")
177
177
  r.spelling.words.should include("ultrasharp")
178
178
  end
179
179
 
180
180
  it 'should provide spelling suggestion collation' do
181
181
  raw_response = eval(mock_response_with_spellcheck_collation)
182
- r = Blacklight::SolrResponse.new(raw_response, {})
182
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
183
183
  r.spelling.collation.should == 'dell ultrasharp'
184
184
  end
185
185
 
186
186
  it "should provide MoreLikeThis suggestions" do
187
187
  raw_response = eval(mock_response_with_more_like_this)
188
- r = Blacklight::SolrResponse.new(raw_response, {})
188
+ r = Ansr::Blacklight::Solr::Response.new(raw_response, {})
189
189
  r.more_like(double(:id => '79930185')).should have(2).items
190
190
  end
191
191
 
192
192
  it "should be empty when the response has no results" do
193
- r = Blacklight::SolrResponse.new({}, {})
193
+ r = Ansr::Blacklight::Solr::Response.new({}, {})
194
194
  r.stub(:total => 0)
195
195
  expect(r).to be_empty
196
196
  end
@@ -106,7 +106,6 @@ describe Ansr::Blacklight::Relation do
106
106
  let(:visitor) { @visitor }
107
107
 
108
108
  it "should accept valid parameters" do
109
- config = Blacklight::Configuration.new
110
109
  query = visitor.accept subject.build_arel.ast
111
110
  expect(query.path).to eq('outside')
112
111
  expect(query.to_hash).to eq({"defType" => "had",
@@ -26,7 +26,7 @@ describe Ansr::Blacklight do
26
26
 
27
27
  before do
28
28
  Object.const_set('GroupModel', Class.new(TestModel))
29
- GroupModel.solr = stub_solr(sample_response)
29
+ GroupModel.solr = stub_solr(sample_response.to_s)
30
30
  GroupModel.configure do |config|
31
31
  config[:table_class] = TestTable
32
32
  end
@@ -37,11 +37,13 @@ describe Ansr::Blacklight do
37
37
  end
38
38
 
39
39
  let(:response) do
40
- create_response(sample_response)
40
+ rel = GroupModel.group("result_group_ssi")
41
+ rel.load
42
+ rel
41
43
  end
42
44
 
43
45
  let(:group) do
44
- response.grouped(GroupModel).select { |x| x.key == "result_group_ssi" }.first
46
+ response.group_by.first
45
47
  end
46
48
 
47
49
  subject do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansr_blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ansr
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.3
19
+ version: 0.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.3
26
+ version: 0.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json-ld
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,6 +86,34 @@ dependencies:
86
86
  - - <
87
87
  - !ruby/object:Gem::Version
88
88
  version: '5'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rsolr
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: 1.0.6
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 1.0.6
103
+ - !ruby/object:Gem::Dependency
104
+ name: kaminari
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '0.13'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ version: '0.13'
89
117
  - !ruby/object:Gem::Dependency
90
118
  name: sass-rails
91
119
  requirement: !ruby/object:Gem::Requirement