File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ export class Fedora {
92
92
return data ;
93
93
}
94
94
95
+ public clearCache ( pid : string ) : void {
96
+ this . cache [ pid ] = { } ;
97
+ }
98
+
95
99
protected getCache ( pid : string , key : string ) : string {
96
100
if ( typeof this . cache [ pid ] === "undefined" || typeof this . cache [ pid ] [ key ] === "undefined" ) {
97
101
return null ;
Original file line number Diff line number Diff line change @@ -19,11 +19,8 @@ class MetadataExtractor {
19
19
* @returns Record mapping field names to values
20
20
*/
21
21
public extractMetadata ( dc : DC ) : Record < string , Array < string > > {
22
- if ( typeof dc . children === "undefined" ) {
23
- throw new Error ( "Unexpected failure: childless Dublin Core!" ) ;
24
- }
25
22
const metadata : Record < string , Array < string > > = { } ;
26
- dc . children . forEach ( ( field ) => {
23
+ ( dc ? .children ?? [ ] ) . forEach ( ( field ) => {
27
24
if ( typeof metadata [ field . name ] === "undefined" ) {
28
25
metadata [ field . name ] = [ ] ;
29
26
}
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ class SolrIndexer {
64
64
}
65
65
66
66
async indexPid ( pid : string ) : Promise < NeedleResponse > {
67
+ // Empty out Fedora cache data to be sure we get the latest
68
+ // information while indexing.
69
+ // TODO: review datastream caching logic; do we need it? Is there a better way?
70
+ this . hierarchyCollector . fedora . clearCache ( pid ) ;
67
71
const fedoraFields = await this . getFields ( pid ) ;
68
72
return await this . solr . indexRecord ( this . config . solrCore , fedoraFields ) ;
69
73
}
You can’t perform that action at this time.
0 commit comments