cul_hydra 1.4.12 → 1.4.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5275607a41c2fcccd7c963551e5c258e99a8e9c3
4
- data.tar.gz: 9239f43187013c44790e72f15332da3509da3a70
3
+ metadata.gz: b00a31481023d67e45fbcc98632503d040588153
4
+ data.tar.gz: 3ed19c422e4756423635b9d05d8d69ddfc18fb62
5
5
  SHA512:
6
- metadata.gz: e9722b9f154c4fe2e72095d601f4fae1e92514cf68f573f1601f31223a547f1073bf5b86cb2c1b1e1033e07d414f72a8b5e8c278ea06d4881a9d4921399e5702
7
- data.tar.gz: 6c573233c1c838452c1dbe5aa7b17058ac6f28ba3033dc163f2d392fb0b90390b9f756793af99ec3f2fb5596b658f76d40fa0f53efbbdbbf16b85d6b391f4bd6
6
+ metadata.gz: dbf2ede45ca288de1a36a4d86cd8691950b1202dd8ba46462f84940006f517471bba2fde83f942761c33c64ae21921efbb2eb17d4cd224e85942602f45651258
7
+ data.tar.gz: 4527adec810592381e6e30b6f02c0f34ca8a256e824ad665aa5255868a8ca262e38cebef17a2ae0eecdc6e88d6a280019b813ed92e38b94e663aa05ce417e187
@@ -3,8 +3,9 @@ class ContentAggregator < GenericAggregator
3
3
  rdf_types(RDF::PCDM.Object)
4
4
  def to_solr(solr_doc = Hash.new, opts={})
5
5
  solr_doc = super
6
- self.members.each do |member_doc|
7
- member = ActiveFedora::Base.find(member_doc['id'])
6
+
7
+ Cul::Hydra::RisearchMembers.get_direct_members_with_datastream_pids(self.pid, 'fulltext').each do |pid|
8
+ member = ActiveFedora::Base.find(pid)
8
9
  if member.is_a? GenericResource
9
10
  member_doc = member.to_solr
10
11
  unless member_doc["fulltext_tesim"].blank?
@@ -12,6 +13,7 @@ class ContentAggregator < GenericAggregator
12
13
  end
13
14
  end
14
15
  end
16
+
15
17
  solr_doc
16
18
  end
17
19
  end
@@ -6,7 +6,7 @@ module ClassMethods
6
6
  recursive_member_query =
7
7
  'select $child $parent from <#ri>
8
8
  where
9
- walk($child <http://purl.oclc.org/NET/CUL/memberOf> <fedora:' + pid + '> and $child <http://purl.oclc.org/NET/CUL/memberOf> $parent)'
9
+ walk($child <http://purl.oclc.org/NET/CUL/memberOf> <fedora:' + pid + '> and $child <http://purl.oclc.org/NET/CUL/memberOf> $parent)'
10
10
 
11
11
  unless cmodel_type == 'all'
12
12
  recursive_member_query += ' and $child <fedora-model:hasModel> $cmodel'
@@ -59,6 +59,38 @@ module ClassMethods
59
59
  return count.blank? ? 0 : count[0]['count'].to_i
60
60
  end
61
61
 
62
+ def get_direct_members_with_datastream_results(pid, dsid, flush_resource_index_before_query=false, verbose_output=false, format='json')
63
+ # Note: The query we're using below is a faster version of this query:
64
+ # "select $pid from <#ri>
65
+ # where $pid <http://purl.oclc.org/NET/CUL/memberOf> <fedora:#{pid}>
66
+ # and $pid <fedora-view:disseminates> $ds
67
+ # and $ds <fedora-view:disseminationType> <info:fedora/*/#{dsid}>"
68
+
69
+ direct_members_with_ds_query = "select $pid
70
+ count( select $ds from <#ri> where $pid <fedora-view:disseminates> $ds and $ds <fedora-view:disseminationType> <info:fedora/*/#{dsid}>)
71
+ from <#ri>
72
+ where $pid <http://purl.oclc.org/NET/CUL/memberOf> <info:fedora/#{pid}>
73
+ having $k0 <http://mulgara.org/mulgara#occursMoreThan> '0.0'^^<http://www.w3.org/2001/XMLSchema#double>;"
74
+
75
+ puts 'Performing query:' if verbose_output
76
+ puts direct_members_with_ds_query if verbose_output
77
+
78
+ search_response = JSON.parse(Cul::Hydra::Fedora.repository.find_by_itql(direct_members_with_ds_query, {
79
+ :type => 'tuples',
80
+ :format => format,
81
+ :limit => '',
82
+ :stream => 'on',
83
+ :flush => flush_resource_index_before_query.to_s
84
+ }))
85
+
86
+ return search_response['results']
87
+ end
88
+
89
+ def get_direct_members_with_datastream_pids(pid, dsid, flush_resource_index_before_query=false, verbose_output=false)
90
+ unique_pids = get_direct_members_with_datastream_results(pid, dsid, flush_resource_index_before_query, verbose_output, 'json')
91
+ unique_pids.map{|result| result['pid'].gsub('info:fedora/', '') }.uniq
92
+ end
93
+
62
94
  #Project constituents
63
95
 
64
96
  def get_project_constituent_results(pid, verbose_output=false, format='json')
@@ -89,9 +121,9 @@ module ClassMethods
89
121
  count = get_project_constituent_results(pid,verbose_output,'count/json')
90
122
  return count.blank? ? 0 : count[0]['count'].to_i
91
123
  end
92
-
124
+
93
125
  #Publish target members
94
-
126
+
95
127
  def get_publish_target_member_results(pid, verbose_output=false, format='json')
96
128
 
97
129
  project_constituent_query =
@@ -120,13 +152,13 @@ module ClassMethods
120
152
  count = get_publish_target_member_results(pid,verbose_output,'count/json')
121
153
  return count.blank? ? 0 : count[0]['count'].to_i
122
154
  end
123
-
155
+
124
156
  # Returns the pid of the first object found with the given identifier
125
157
  def get_pid_for_identifier(identifier, flush_resource_index_before_query=false)
126
158
  find_by_identifier_query = "select $pid from <#ri>
127
159
  where $pid <http://purl.org/dc/elements/1.1/identifier> $identifier
128
160
  and $identifier <mulgara:is> '#{identifier}'"
129
-
161
+
130
162
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(find_by_identifier_query, {
131
163
  :type => 'tuples',
132
164
  :format => 'json',
@@ -134,39 +166,39 @@ module ClassMethods
134
166
  :stream => 'on',
135
167
  :flush => flush_resource_index_before_query.to_s
136
168
  }))
137
-
169
+
138
170
  if search_response['results'].present?
139
171
  return search_response['results'].first['pid'].gsub('info:fedora/', '')
140
172
  else
141
173
  return nil
142
174
  end
143
175
  end
144
-
176
+
145
177
  # Returns the pids of ALL objects found with the given identifier
146
178
  def get_all_pids_for_identifier(identifier)
147
-
179
+
148
180
  find_by_identifier_query = "select $pid from <#ri>
149
181
  where $pid <http://purl.org/dc/elements/1.1/identifier> $identifier
150
182
  and $identifier <mulgara:is> '#{identifier}'"
151
-
183
+
152
184
  search_response = JSON(Cul::Hydra::Fedora.repository.find_by_itql(find_by_identifier_query, {
153
185
  :type => 'tuples',
154
186
  :format => 'json',
155
187
  :limit => '',
156
188
  :stream => 'on'
157
189
  }))
158
-
190
+
159
191
  pids_to_return = []
160
-
192
+
161
193
  if search_response['results'].present?
162
194
  search_response['results'].each do |result|
163
195
  pids_to_return << result['pid'].gsub('info:fedora/', '')
164
196
  end
165
197
  end
166
-
198
+
167
199
  return pids_to_return
168
200
  end
169
-
201
+
170
202
  end
171
203
  extend ClassMethods
172
- end
204
+ end
@@ -64,13 +64,13 @@ module Cul::Hydra::Solrizer
64
64
  ModsFieldable.normalize(main_title(p_node), true)
65
65
  end
66
66
  end
67
-
67
+
68
68
  def languages_iso639_2_text
69
69
  mods.xpath("./mods:language/mods:languageTerm[@type='text' and @authority='iso639-2']", MODS_NS).collect do |n|
70
70
  ModsFieldable.normalize(n.text, true)
71
71
  end
72
72
  end
73
-
73
+
74
74
  def languages_iso639_2_code
75
75
  mods.xpath("./mods:language/mods:languageTerm[@type='code' and @authority='iso639-2']", MODS_NS).collect do |n|
76
76
  ModsFieldable.normalize(n.text, true)
@@ -210,7 +210,7 @@ module Cul::Hydra::Solrizer
210
210
  end
211
211
  values
212
212
  end
213
-
213
+
214
214
  def sublocation(node=mods)
215
215
  values = node.xpath("./mods:location/mods:sublocation", MODS_NS).collect do |n|
216
216
  ModsFieldable.normalize(n.text, true)
@@ -483,7 +483,7 @@ module Cul::Hydra::Solrizer
483
483
 
484
484
  # Geo data
485
485
  solr_doc["geo"] = coordinates
486
-
486
+
487
487
  ## Handle alternate form of language authority for language_language_term_text_ssim
488
488
  ## We already capture elements when authority="iso639-2b", but we want to additionally
489
489
  ## capture language elements when authority="iso639-2".
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.4.12'
3
+ VERSION = '1.4.13'
4
4
  def self.version
5
5
  VERSION
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module Cul
2
2
  module Hydra
3
- VERSION = '1.4.11'
3
+ VERSION = '1.4.12'
4
4
  def self.version
5
5
  VERSION
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.12
4
+ version: 1.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-01 00:00:00.000000000 Z
12
+ date: 2018-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -582,7 +582,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
582
582
  version: '0'
583
583
  requirements: []
584
584
  rubyforge_project:
585
- rubygems_version: 2.6.12
585
+ rubygems_version: 2.6.14
586
586
  signing_key:
587
587
  specification_version: 4
588
588
  summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps