diff --git a/commit-to-solr.js b/commit-to-solr.js index fbc20915095513dcf52ff13cc49f3e25d13e0cfa..094dd5d1033e74fcf316cec10fc5eb2c07fa8168 100755 --- a/commit-to-solr.js +++ b/commit-to-solr.js @@ -212,9 +212,16 @@ async function purgeSolr() { console.log("All solr documents deleted."); return true } catch(e) { - console.log("Solr error"); - console.log(e.response.status); - return false; + if( e.response ) { + console.log("Solr error"); + + 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) { jsonld: json }); } else { - console.log(`No ${catalogFilename} found in ${object['path']}`); + // console.log(`No ${catalogFilename} found in ${object['path']}`); } } } @@ -378,7 +385,6 @@ async function main () { await updateSchema(solrSchema, configJson['schema']); } - return; const records = await loadFromOcfl(sourcePath); await commitBatches(records); diff --git a/lib/CatalogSolr.js b/lib/CatalogSolr.js index 7b48a75e2455fbaad6f122b8f18a2377afc21c4d..d94960ccbaa9601343a317124d200778ecac8497 100644 --- a/lib/CatalogSolr.js +++ b/lib/CatalogSolr.js @@ -223,7 +223,6 @@ Types with errors: ${this.errors.join(', ')}`); var types = this.crate.utils.asArray(item['@type']); // Look through types in order for (let type of Object.keys(cfTypes)) { - if (types.includes(type)) { // get config for this type of item @@ -243,6 +242,8 @@ Types with errors: ${this.errors.join(', ')}`); // } solrDocument[type].push(solr); + } else { + //console.log("...not indexing, filter failed"); } } } @@ -263,6 +264,7 @@ Types with errors: ${this.errors.join(', ')}`); if( ! fieldcf['skip'] ) { // resolve lookups if( fieldcf['resolve'] ) { + console.log(`Resolving values for ${field}: ${JSON.stringify(value)}`); solr[field] = this.resolveValues(fieldcf['resolve'], value); const vals = this.crate.utils.asArray(solr[field]); solr[`${field}_id`] = []; @@ -272,7 +274,7 @@ Types with errors: ${this.errors.join(', ')}`); solr[`${field}_id`].push(value["@id"]); } catch (e) { - //console.log("ERROR", e.message, val) + console.log("Resolution error: ", e.message, val) } } } else {