ansr_blacklight 0.0.4 → 0.0.5

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
- YTJjYWIyMDhiNWVlNzNiYmRmNGFiMzdkMWQ3MTEyMDc0YmRiOTRmZQ==
4
+ YWNiMzkzODkzYzMwMjA5NTllNTVlYTA5Y2RiOTU2YWM1ZDc2ZWUyZQ==
5
5
  data.tar.gz: !binary |-
6
- ZGQ3NDNkN2YzYzM4OTRiMDc3YWVlOGY2NGQwN2NmMjI2NzU2MWRkNw==
6
+ ZTI4NGU3ZmFlOGMyNmVkMmFjMDA5N2Y4ODg0NjIxODkyZTdmMjUyYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWU2ZTEyMTNiOTIzNDU3ZjA5YTY4NmU1NTA0MGQ2OGMxNDRhMTJkYzgyYTk4
10
- ZjYzNjIzNzgwNTMyMjZmMTQyNjI0Y2RlZDQ4ODc3YTE4MThhOTI5Yjc1OTY3
11
- YmIyYWYyNGZlNWRkMDcxYWIxMjQ0MTY0YWE4YWViNWZhOGRiOTQ=
9
+ YWM1ZjEyZGYzZDE5ZjhiOTRlZjhkNTI5ZGRmZDRlYzVmY2U2OThiYjc1YzBm
10
+ YzgyMmFhMGZiNDUxODMxYmI3OTQ4ODNjNDFjM2JlMzg5MDMzYzAwOTMzOGUw
11
+ NDE2YTRkYzYwMDA0OWFkZTQ5YzgwZGFkM2NhYjExNTlhOTNiY2U=
12
12
  data.tar.gz: !binary |-
13
- ZTIyNTdhOGI0OThmYjUyMjFiODgxMTdjZGRkY2Y5NjE3NjQ4NzFiM2EyNGI4
14
- Yjg3YWNjYjYxNDUxNDE4Zjc5YmQ2YjlmMDlmZGVjMDBkZTkxNmE4NGMwNjFh
15
- NmRiYzE3ZWMwODhmMjU0MzA1MTU1ODkzNzZiMzU2YTNlODFlNDk=
13
+ MDFiZGVkZDdkMWM4MzkyM2UzYWI5Yzk5NjcwNmVhZGY1Zjg3MGU2NzYxY2Fk
14
+ ZWVlMWE1YTk2YzBjMmI4MDExMGU5MWVlYzVmYjM5MzczOWQyZGQzZmE4ZmY2
15
+ Mzk5MDVhMDlhMTJlNjc1MTQxZmFjNGU4YWUyZGIyZTRkYWEzZDM=
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ gemspec
4
+ gem "ansr", :path => '..', :group => :development
@@ -1,7 +1,7 @@
1
1
  module Ansr::Blacklight::Arel::Visitors
2
2
  class ToNoSql < Ansr::Arel::Visitors::ToNoSql
3
-
4
- def initialize(table)
3
+
4
+ def initialize(table, http_method=:get)
5
5
  super(table)
6
6
  end
7
7
 
@@ -9,6 +9,7 @@ module Ansr::Blacklight::ConnectionAdapters
9
9
  super(klass, klass.solr, logger, pool)
10
10
  # the RSolr class has one query method, with the name of the selector the first parm?
11
11
  @method = :send_and_receive
12
+ @http_method = klass.method
12
13
  @visitor = Ansr::Blacklight::Arel::Visitors::ToNoSql.new(@table)
13
14
  end
14
15
 
@@ -28,8 +29,8 @@ module Ansr::Blacklight::ConnectionAdapters
28
29
  def execute(query, name='ANSR-SOLR')
29
30
  query = query.dup
30
31
  # TODO: execution context to assign :post to params[:method]
31
- params = {params: query, method: :get}
32
- params[:data] = params.delete(:params) if params[:method] == :post
32
+ params = {params: query, method: @http_method}
33
+ params[:data] = params.delete(:params) if @http_method == :post
33
34
  raw_response = eval(@connection.send(@method, query.path, params))
34
35
  Ansr::Blacklight::Solr::Response.new(raw_response, raw_response['params'])
35
36
  end
@@ -24,6 +24,11 @@ module Ansr::Blacklight::Model
24
24
  def references
25
25
  []
26
26
  end
27
+ def ansr_query(*args)
28
+ ansr_query = super(*args)
29
+ ansr_query.http_method = args[2] if args[2]
30
+ ansr_query
31
+ end
27
32
  end
28
33
  end
29
34
  end
@@ -53,7 +53,7 @@ module Ansr::Blacklight
53
53
 
54
54
  def group_by(key=self.group_values.first)
55
55
  loaded
56
- response.grouped(model()).select { |x| x.key == key.to_s }
56
+ response.group(key, model)
57
57
  end
58
58
  end
59
59
  end
@@ -16,7 +16,7 @@ class Ansr::Blacklight::Solr::Response < HashWithIndifferentAccess
16
16
  @request_params = request_params
17
17
  extend Spelling
18
18
  extend Ansr::Facets
19
- extend Response
19
+ extend InternalResponse
20
20
  extend MoreLikeThis
21
21
  end
22
22
 
@@ -64,15 +64,15 @@ class Ansr::Blacklight::Solr::Response < HashWithIndifferentAccess
64
64
  end
65
65
  end
66
66
 
67
- def group key
68
- grouped.select { |x| x.key == key }.first
67
+ def group key, model
68
+ grouped(model).select { |x| x.key == key }.first
69
69
  end
70
70
 
71
71
  def grouped?
72
72
  self.has_key? "grouped"
73
73
  end
74
74
 
75
- module Response
75
+ module InternalResponse
76
76
  def response
77
77
  self[:response] || {}
78
78
  end
@@ -69,6 +69,7 @@ describe Ansr::Blacklight do
69
69
  subject { FacetModel }
70
70
 
71
71
  it "should send a post request to solr and get a response back" do
72
+ subject.method = :post
72
73
  rel = subject.where(:q => @all_docs_query)
73
74
  subject.solr= stub_solr(JSON.parse(@abc_resp).inspect)
74
75
  expect(rel.length).to be >= 1
@@ -42,12 +42,16 @@ describe Ansr::Blacklight do
42
42
  rel
43
43
  end
44
44
 
45
- let(:group) do
46
- response.group_by.first
45
+ let(:group_response) do
46
+ response.group_by
47
47
  end
48
48
 
49
- subject do
50
- group.groups.first
49
+ let(:groups) do
50
+ group_response.groups #.first
51
+ end
52
+
53
+ subject do
54
+ groups.first
51
55
  end
52
56
 
53
57
  describe Ansr::Blacklight::Solr::Response::Group 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.4
4
+ version: 0.0.5
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-25 00:00:00.000000000 Z
11
+ date: 2014-04-26 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.4
19
+ version: 0.0.5
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.4
26
+ version: 0.0.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json-ld
29
29
  requirement: !ruby/object:Gem::Requirement