I use an application that stores data to solr. Unfortunately this one can only write single-values to solr. But some of the data have multiple date-values. So to search them I n
StatelessScriptUpdateProcessorFactory that enables the use of
update processors implemented as scripts during update request.
When Solr update the document then we get the field value in which multiple dates are coming in StatelessScriptUpdateProcessorFactory. We split the value and put into new field.
Lets say multiDate is the string field in which multiple dates are coming and date is multivalued field having tdate as field type.
Below is the sample update-script.js.
function processAdd(cmd) {
doc = cmd.solrDoc;
multiDate = doc.getFieldValue("multiDate").toString();
dates = multiDate.split("\\$");
doc.setField("date",dates);
}
function processDelete(cmd) {
// no-op
}
function processMergeIndexes(cmd) {
// no-op
}
function processCommit(cmd) {
// no-op
}
function processRollback(cmd) {
// no-op
}
function finish() {
// no-op
}
Add the StatelessScriptUpdateProcessorFactory processor to the updateRequestProcessorChain in solrconfig.xml.
updateProcessor.js
l