Skip to content
Snippets Groups Projects
Commit ab334b0b authored by Mike Lynch's avatar Mike Lynch
Browse files

Sorted out a few more bugs, removed a lot of debugging messages

parent 9134db14
No related merge requests found
...@@ -212,9 +212,16 @@ async function purgeSolr() { ...@@ -212,9 +212,16 @@ async function purgeSolr() {
console.log("All solr documents deleted."); console.log("All solr documents deleted.");
return true return true
} catch(e) { } catch(e) {
console.log("Solr error"); if( e.response ) {
console.log(e.response.status); console.log("Solr error");
return false;
console.log(e.response.status);
return false;
} else {
console.log("General error");
console.log(e);
process.exit(-1);
}
} }
} }
...@@ -245,7 +252,7 @@ async function loadFromOcfl(repoPath) { ...@@ -245,7 +252,7 @@ async function loadFromOcfl(repoPath) {
jsonld: json jsonld: json
}); });
} else { } else {
console.log(`No ${catalogFilename} found in ${object['path']}`); // console.log(`No ${catalogFilename} found in ${object['path']}`);
} }
} }
} }
...@@ -378,7 +385,6 @@ async function main () { ...@@ -378,7 +385,6 @@ async function main () {
await updateSchema(solrSchema, configJson['schema']); await updateSchema(solrSchema, configJson['schema']);
} }
return;
const records = await loadFromOcfl(sourcePath); const records = await loadFromOcfl(sourcePath);
await commitBatches(records); await commitBatches(records);
......
...@@ -223,7 +223,6 @@ Types with errors: ${this.errors.join(', ')}`); ...@@ -223,7 +223,6 @@ Types with errors: ${this.errors.join(', ')}`);
var types = this.crate.utils.asArray(item['@type']); var types = this.crate.utils.asArray(item['@type']);
// Look through types in order // Look through types in order
for (let type of Object.keys(cfTypes)) { for (let type of Object.keys(cfTypes)) {
if (types.includes(type)) { if (types.includes(type)) {
// get config for this type of item // get config for this type of item
...@@ -243,6 +242,8 @@ Types with errors: ${this.errors.join(', ')}`); ...@@ -243,6 +242,8 @@ Types with errors: ${this.errors.join(', ')}`);
// } // }
solrDocument[type].push(solr); solrDocument[type].push(solr);
} else {
//console.log("...not indexing, filter failed");
} }
} }
} }
...@@ -263,6 +264,7 @@ Types with errors: ${this.errors.join(', ')}`); ...@@ -263,6 +264,7 @@ Types with errors: ${this.errors.join(', ')}`);
if( ! fieldcf['skip'] ) { if( ! fieldcf['skip'] ) {
// resolve lookups // resolve lookups
if( fieldcf['resolve'] ) { if( fieldcf['resolve'] ) {
console.log(`Resolving values for ${field}: ${JSON.stringify(value)}`);
solr[field] = this.resolveValues(fieldcf['resolve'], value); solr[field] = this.resolveValues(fieldcf['resolve'], value);
const vals = this.crate.utils.asArray(solr[field]); const vals = this.crate.utils.asArray(solr[field]);
solr[`${field}_id`] = []; solr[`${field}_id`] = [];
...@@ -272,7 +274,7 @@ Types with errors: ${this.errors.join(', ')}`); ...@@ -272,7 +274,7 @@ Types with errors: ${this.errors.join(', ')}`);
solr[`${field}_id`].push(value["@id"]); solr[`${field}_id`].push(value["@id"]);
} }
catch (e) { catch (e) {
//console.log("ERROR", e.message, val) console.log("Resolution error: ", e.message, val)
} }
} }
} else { } else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment