|
|
@ -57,10 +57,7 @@ function synthesizeDocs(result) { |
|
|
|
return esDoc.data; |
|
|
|
return esDoc.data; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return result.lineage.map((hierarchy) => { |
|
|
|
result.lineage.map((hierarchy) => { |
|
|
|
// clear out the effects of the last hierarchy array (this effectively clones the base Document)
|
|
|
|
|
|
|
|
doc.clearAlpha3().clearAllParents(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(hierarchy) |
|
|
|
Object.keys(hierarchy) |
|
|
|
.filter(doc.isSupportedParent) |
|
|
|
.filter(doc.isSupportedParent) |
|
|
|
.filter((placetype) => { return !_.isEmpty(_.trim(hierarchy[placetype].name)); } ) |
|
|
|
.filter((placetype) => { return !_.isEmpty(_.trim(hierarchy[placetype].name)); } ) |
|
|
@ -76,6 +73,7 @@ function synthesizeDocs(result) { |
|
|
|
hierarchy[placetype].abbr); |
|
|
|
hierarchy[placetype].abbr); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const esDoc = doc.toESDocument(); |
|
|
|
const esDoc = doc.toESDocument(); |
|
|
|
esDoc.data._id = esDoc._id; |
|
|
|
esDoc.data._id = esDoc._id; |
|
|
@ -83,8 +81,6 @@ function synthesizeDocs(result) { |
|
|
|
|
|
|
|
|
|
|
|
return esDoc.data; |
|
|
|
return esDoc.data; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -129,6 +125,12 @@ function setup(placeholderService, should_execute) { |
|
|
|
results.filter(layersFilter).map(synthesizeDocs)) |
|
|
|
results.filter(layersFilter).map(synthesizeDocs)) |
|
|
|
.filter(countryFilter); |
|
|
|
.filter(countryFilter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const messageParts = [ |
|
|
|
|
|
|
|
'[controller:placeholder]', |
|
|
|
|
|
|
|
`[result_count:${_.get(res, 'data', []).length}]` |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info(messageParts.join(' ')); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return next(); |
|
|
|
return next(); |
|
|
|