hydra-collections 4.0.0.beta2 → 4.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/hydra/collections_controller_behavior.rb +2 -2
- data/app/helpers/collections_search_helper.rb +1 -2
- data/lib/hydra/collections/collectible.rb +5 -2
- data/lib/hydra/collections/version.rb +1 -1
- data/spec/controllers/collections_controller_spec.rb +6 -6
- data/spec/helpers/collections_search_helper_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3c19c725d2aaea1f447768b62c9025d258829e
|
4
|
+
data.tar.gz: e15c3a7eedf2189af5dc15707c45fd2c7bbe4618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799056d3aa822e1777de9a149da7c88734b5f4a79b4dc33b208480ec55761f84cad5e41276806f30e65520e80cb2276bc9614db05cfe6b87a2f485ecda2409c2
|
7
|
+
data.tar.gz: b8cb44470bcddd4cd75927a1f6fc25bca71269b0dc10b9a7cabf287ec582de0485deaa7199aaed43ee2c0056a26648b7bea488ca89c10d36a83bd60a167e74a2
|
@@ -1,11 +1,11 @@
|
|
1
|
-
include Blacklight::SolrHelper
|
2
|
-
|
3
1
|
module Hydra
|
4
2
|
module CollectionsControllerBehavior
|
5
3
|
extend ActiveSupport::Concern
|
6
4
|
|
7
5
|
included do
|
8
6
|
include Blacklight::Configurable
|
7
|
+
include Blacklight::SolrHelper
|
8
|
+
|
9
9
|
include Hydra::Collections::AcceptsBatches
|
10
10
|
include Hydra::Collections::SelectsCollections
|
11
11
|
|
@@ -5,8 +5,7 @@ module CollectionsSearchHelper
|
|
5
5
|
# @return [String] the title of the collection if available, otherwise its pid
|
6
6
|
def collection_name(collection_pid)
|
7
7
|
#TODO this can be loaded from solr
|
8
|
-
|
9
|
-
Collection.find(collection_pid).title.result || collection_pid
|
8
|
+
Collection.find(collection_pid).title || collection_pid
|
10
9
|
end
|
11
10
|
|
12
11
|
end
|
@@ -19,8 +19,11 @@ module Hydra::Collections::Collectible
|
|
19
19
|
# return solr_doc
|
20
20
|
# end
|
21
21
|
def index_collection_ids(solr_doc={})
|
22
|
-
|
23
|
-
|
22
|
+
# CollectionAssociation#ids_reader loads from solr on each call, so only call it once
|
23
|
+
# see https://github.com/projecthydra/active_fedora/issues/644
|
24
|
+
ids = collection_ids
|
25
|
+
solr_doc[Solrizer.solr_name(:collection, :facetable)] = ids
|
26
|
+
solr_doc[Solrizer.solr_name(:collection)] = ids
|
24
27
|
solr_doc
|
25
28
|
end
|
26
29
|
|
@@ -67,7 +67,7 @@ describe CollectionsController, :type => :controller do
|
|
67
67
|
@asset1 = GenericFile.create!
|
68
68
|
post :create, batch_document_ids: [@asset1], collection: {title: "My Secong Collection ", description: "The Description\r\n\r\nand more"}
|
69
69
|
expect(assigns[:collection].members).to eq [@asset1]
|
70
|
-
asset_results =
|
70
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
71
71
|
expect(asset_results["response"]["numFound"]).to eq(1)
|
72
72
|
doc = asset_results["response"]["docs"].first
|
73
73
|
expect(doc["id"]).to eq(@asset1.id)
|
@@ -79,7 +79,7 @@ describe CollectionsController, :type => :controller do
|
|
79
79
|
@asset2 = GenericFile.create!
|
80
80
|
post :create, batch_document_ids: [@asset1,@asset2], collection: {title: "My Secong Collection ", description: "The Description\r\n\r\nand more"}
|
81
81
|
expect(assigns[:collection].members).to eq([@asset1,@asset2])
|
82
|
-
asset_results =
|
82
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
83
83
|
expect(asset_results["response"]["numFound"]).to eq(1)
|
84
84
|
doc = asset_results["response"]["docs"].first
|
85
85
|
expect(doc["id"]).to eq(@asset1.id)
|
@@ -145,7 +145,7 @@ describe CollectionsController, :type => :controller do
|
|
145
145
|
@asset2.reload
|
146
146
|
expect(@asset2.to_solr[Solrizer.solr_name(:collection)]).to eq [@collection.id]
|
147
147
|
## Check that member was re-indexed with collection info
|
148
|
-
asset_results =
|
148
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
149
149
|
doc = asset_results["response"]["docs"].first
|
150
150
|
expect(doc["id"]).to eq(@asset2.id)
|
151
151
|
expect(doc[Solrizer.solr_name(:collection)]).to eq [@collection.id]
|
@@ -159,7 +159,7 @@ describe CollectionsController, :type => :controller do
|
|
159
159
|
expect(@asset2.to_solr[Solrizer.solr_name(:collection)]).to eq([])
|
160
160
|
|
161
161
|
## Check that member was re-indexed without collection info
|
162
|
-
asset_results =
|
162
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
163
163
|
doc = asset_results["response"]["docs"].first
|
164
164
|
expect(doc["id"]).to eq(@asset2.id)
|
165
165
|
expect(doc[Solrizer.solr_name(:collection)]).to be_nil
|
@@ -210,14 +210,14 @@ describe CollectionsController, :type => :controller do
|
|
210
210
|
@asset1 = @asset1.reload
|
211
211
|
@asset1.update_index
|
212
212
|
expect(@asset1.collections).to eq [@collection]
|
213
|
-
asset_results =
|
213
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
214
214
|
expect(asset_results["response"]["numFound"]).to eq(1)
|
215
215
|
doc = asset_results["response"]["docs"].first
|
216
216
|
expect(doc[Solrizer.solr_name(:collection)]).to eq([@collection.id])
|
217
217
|
|
218
218
|
delete :destroy, id: @collection
|
219
219
|
expect(@asset1.reload.collections).to eq([])
|
220
|
-
asset_results =
|
220
|
+
asset_results = ActiveFedora::SolrService.instance.conn.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
|
221
221
|
expect(asset_results["response"]["numFound"]).to eq(1)
|
222
222
|
doc = asset_results["response"]["docs"].first
|
223
223
|
expect(doc[Solrizer.solr_name(:collection)]).to be_nil
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe CollectionsSearchHelper, :type => :helper do
|
4
4
|
describe "collection_name" do
|
5
|
-
let
|
6
|
-
let
|
5
|
+
let(:collection_without_title) { Collection.create!() }
|
6
|
+
let(:collection_with_title) { Collection.create!(title: "Title of Collection 2") }
|
7
7
|
|
8
8
|
it "should return the pid if no title available" do
|
9
9
|
expect(collection_name(collection_without_title.id)).to eq collection_without_title.id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-collections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carolyn Cole
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|