lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lambrou, Ioannis" <Ioannis.Lamb...@ncr.com>
Subject StatelessScriptUpdateProcessorFactory with multiple shards
Date Wed, 23 Nov 2016 13:06:40 GMT
Hello all,

I am using solr 5.5 and I am trying to use StatelessScriptUpdateProcessorFactory to append
the data I am adding to solr to existing documents. This is working fine when I use one shard
but it doesn't work on multiple shards.

Is there any way to use it with multiple shards?

This is the updateProcessor.js:

function processAdd(cmd) {
        logger.error(" >> processAdd")
    var name="";
    var startDate="";
    var dataCurr="";
    doc = cmd.solrDoc;
    var previousDoc=null;
    var previousData="";
    nameDoc=doc.getField("name");
    if( nameDoc !=null ){
    name=doc.getFieldValue("name").toString();
    startDate= doc.getFieldValue("start_date_s").toString();
    dataCurr=doc.getFieldValue("data_ws").toString();
    }
    try{
        var Term = Java.type("org.apache.lucene.index.Term");
        previousDocId= req.getSearcher().getFirstMatch(new Term("id",name+"_"+startDate));
        previousDoc=req.getSearcher().doc(previousDocId);
        previousData= previousDoc.getField("data_ws").stringValue();
        doc.setField("data_ws",previousData+dataCurr);
    }
catch(err){

    logger.error("error in update processor "+err)
}
doc.setField("id",name+"_"+startDate);
}


function processDelete(cmd) {
  // no-op
}

function processMergeIndexes(cmd) {
  // no-op
}

function processCommit(cmd) {
  // no-op
}

function processRollback(cmd) {
  // no-op
}

function finish() {
  // no-op
}

Thanks and Regards,
Giannis




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message