hydra-collections 4.0.0.beta2 → 4.0.0.beta3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 878b10998101cbd6d3b1420408215b6605180517
4
- data.tar.gz: 015496e71bfabd20eb28668f4dd1d42ed3a83b48
3
+ metadata.gz: fb3c19c725d2aaea1f447768b62c9025d258829e
4
+ data.tar.gz: e15c3a7eedf2189af5dc15707c45fd2c7bbe4618
5
5
  SHA512:
6
- metadata.gz: 374d069be8e10287435c0544a8c571da379cfd8e86d05176f327a4340cba7c95df59005ef599106a516d4f33b1ba0763d1ecded7a9b61546886f229e75c8c64d
7
- data.tar.gz: ed325dd51ed6abbfd585702f9a6f796f9d66b088767b4230100669e4116cdcd0678d91a687f0cda705fe3a68f03dce186a3941ba97cf4370f082a1c355e56a6f
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
- # the .result is due to ActiveTriples/ActiveTripes#74
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
- solr_doc[Solrizer.solr_name(:collection, :facetable)] = self.collection_ids
23
- solr_doc[Solrizer.solr_name(:collection)] = self.collection_ids
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
 
@@ -1,5 +1,5 @@
1
1
  module Hydra
2
2
  module Collections
3
- VERSION = "4.0.0.beta2"
3
+ VERSION = "4.0.0.beta3"
4
4
  end
5
5
  end
@@ -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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset2.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 = blacklight_solr.get "select", params:{fq:["id:\"#{@asset1.id}\""],fl:['id',Solrizer.solr_name(:collection)]}
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 (:collection_without_title) { Collection.create!() }
6
- let (:collection_with_title) { Collection.create(title: "Title of Collection 2") }
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.beta2
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-06 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight