cdmbl 0.12.0 → 0.12.1
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 +4 -4
- data/README.md +3 -7
- data/lib/cdmbl/transformer.rb +26 -2
- data/lib/cdmbl/version.rb +1 -1
- 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: 1bc016b40abd27b9baac690f97ea48435d17ef06
|
4
|
+
data.tar.gz: a2da418f1cecb665b33b7467e8525c74973b8b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c534d8aa324a83b59539f78203228747eae184db582ddedcbe5abdd468460bb48911e575c77dee3bc48ecc75d3a5623ba9f554f3ebb6f77cef995e0c0f42b7
|
7
|
+
data.tar.gz: fca0699d76b7cf99d76895ccdf205b882b141b757d62958aded540218e7ff43bd822544f561ebfc6a0feac966da38e3fe47530df69a68105dcbb6fb3febf4ae3
|
data/README.md
CHANGED
@@ -146,11 +146,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/UMNLib
|
|
146
146
|
|
147
147
|
[MIT](/LICENSE.txt)
|
148
148
|
|
149
|
-
##
|
149
|
+
## TODO
|
150
150
|
|
151
|
-
|
152
|
-
|
153
|
-
* Asyncronous thumbnail caching (e.g. https://github.com/UMNLibraries/mdl_search/blob/master/app/controllers/catalog_controller.rb#L34)
|
154
|
-
* A (very simple) model to keep track of indexing runs (used like this: https://github.com/UMNLibraries/mdl_search/blob/master/lib/tasks/ingester.rake#L6)
|
155
|
-
* A template to over-write the standard BL catalog controller to make use of the CDM solr fields?
|
156
|
-
* The [react-borealis viewer](https://github.com/UMNLibraries/react-borealis)
|
151
|
+
* Make StripFormatter the default formatter so it doesn't need to be declared for every field
|
152
|
+
* Re-brand project: CONTENTdm Indexer. CDMBL doesn't necessarily require Blacklight. Moreover only handles indexing.
|
data/lib/cdmbl/transformer.rb
CHANGED
@@ -7,23 +7,47 @@ module CDMBL
|
|
7
7
|
attr_reader :cdm_records,
|
8
8
|
:oai_sets,
|
9
9
|
:field_mappings,
|
10
|
+
:extract_compounds,
|
10
11
|
:record_transformer
|
11
12
|
def initialize(cdm_records: [],
|
12
13
|
oai_sets: {},
|
13
14
|
field_mappings: false,
|
15
|
+
extract_compounds: false,
|
14
16
|
record_transformer: RecordTransformer)
|
15
|
-
@cdm_records
|
17
|
+
@cdm_records = cdm_records.map do |record|
|
18
|
+
record.merge('record_type' => 'primary')
|
19
|
+
end
|
16
20
|
@oai_sets = oai_sets
|
17
21
|
@field_mappings = mappings_init(field_mappings)
|
22
|
+
@extract_compounds = extract_compounds
|
18
23
|
@record_transformer = record_transformer
|
19
24
|
end
|
20
25
|
|
21
26
|
def records
|
22
|
-
|
27
|
+
raw_records.map { |record| to_solr(record) }.compact
|
23
28
|
end
|
24
29
|
|
30
|
+
|
25
31
|
private
|
26
32
|
|
33
|
+
def raw_records
|
34
|
+
extract_compounds == false ? cdm_records : cdm_records.concat(compounds)
|
35
|
+
end
|
36
|
+
|
37
|
+
# The 'page' key holds the children of a given record
|
38
|
+
def compounds
|
39
|
+
# Get all the records with compounds
|
40
|
+
cdm_records.reject do |record|
|
41
|
+
record['page'].nil?
|
42
|
+
# Get just the compound data
|
43
|
+
end.map do |record|
|
44
|
+
record['page'].map do |page|
|
45
|
+
# Associate each compound child with its parent
|
46
|
+
page.merge!('parent_id' => record['id'], 'record_type' => 'secondary')
|
47
|
+
end
|
48
|
+
end.flatten
|
49
|
+
end
|
50
|
+
|
27
51
|
def mappings_init(mappings)
|
28
52
|
(mappings) ? mappings : self.class.default_mappings
|
29
53
|
end
|
data/lib/cdmbl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cdmbl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chadfennell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hash_at_path
|