Sometimes it is desirable to add information to documents as they are sent to the Index-Pipeline. For example, say that we were attempting to index a series of PDF documents via the API, and would like to make the ID of each doument the URL location where it will be hosted (or otherwise process and store the URL in the document).
Additional information can be included in the form of URL parameters in the request to the Index-Pipeline API. The parameters names are your choice (although it may be helpful to avoid potentially significant terms). For example:
curl -u $user:$password -X POST -H "Content-Type: application/pdf" "http://<FUSION_HOST>:8764/api/apps/<APP_NAME>/index/<INDEX_PIPELINE_NAME>?test=TEST123456789" --data-binary @dummy.pdf
This can then be accessed within the context variables in an Index Pipeline JavaScript stage:
function(doc, context) {
logger.info("THIS IS THE VALUE IN OUR PARAM");
var testVal = context.solrParams.test;
logger.info(testVal);
// code for adding the "testVal" value ("TEST123456789") to the doc object
return doc;
}
Comments
0 comments
Article is closed for comments.