1

I need to convert a field say,timestamp_ms(ex: 1473794840429) which is in long data type to solr date format yyyy-mm-ddThh:mm:ssZ through Solr ScriptUpdateProcessor.

Below is my solrconfig.xml

<processor name="script" class="solr.StatelessScriptUpdateProcessorFactory">
    <str name="script">date-update.js</str>
</processor> 

and my date-update.js is:

function processAdd(cmd) {
doc = cmd.solrDoc;  // org.apache.solr.common.SolrInputDocument
var datecheck = doc.getFieldValue("timestamp_ms");
var date1 = new Date(datecheck);  
var date2= date1.toUTCString();
doc.setField("tweet_date",date2);
}

-date2 is stored as string datatype.

When I reload the core and post documents I get the below error:

org.apache.solr.common.SolrException: RunUpdateProcessor has received an AddUpdateCommand containing a document that appears to still contain Atomic document update operations,​ most likely because DistributedUpdateProcessorFactory was explicitly disabled from this updateRequestProcessorChain

How do I solve this?

femtoRgon
  • 32,893
  • 7
  • 60
  • 87
Anurag.D
  • 21
  • 4

2 Answers2

0

Atomic updates require Solr Transaction Log to be enabled, so the first thing is to ensure you have an updateLog config set in solrconfig.xml :

<updateLog>
  <str name="dir">${solr.ulog.dir:}</str>
</updateLog>
EricLavault
  • 12,130
  • 3
  • 23
  • 45
0

Make sure you have in the js file a function called finish like:

function finish(){

}

and make sure that in your solrconfig.xml after your processor, you add the following otherwise no update will happen at all:

<processor class="solr.LogUpdateProcessorFactory" />
<processor class="solr.RunUpdateProcessorFactory" />

So your solrconfig.xml would look like:

 <updateRequestProcessorChain name="mychain" default="true">
      <processor name="script" class="solr.StatelessScriptUpdateProcessorFactory">
        <str name="script">last_reaction_date.js</str>
      </processor> 
      <processor class="solr.LogUpdateProcessorFactory" />
      <processor class="solr.RunUpdateProcessorFactory" />
 </updateRequestProcessorChain>