lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhawna singh <singhbha...@gmail.com>
Subject Null exception in UpdateRequestProcessor
Date Sat, 20 Aug 2011 18:44:01 GMT
Hi All,

I am trying to add a field in my Solr document based on the domain.
Now that I have set it up using UpdateProcessorChain, I am running into null
exception.
Here is what I have-
In SolrConfig.xml
<updateRequestProcessorChain name="mychain" >
    <processor class="mysolr.AddConditionalFieldsFactory" >
  </processor>
   <processor class="solr.RunUpdateProcessorFactory" />
   <processor class="solr.LogUpdateProcessorFactory" />
 </updateRequestProcessorChain>


  <requestHandler name="/update/csv" class="solr.CSVRequestHandler"
startup="lazy" >
        <lst name="defaults">
            <str name="update.chain">mychain</str>
        </lst>
</requestHandler>


Here is my java code-
package mysolr;


import java.io.IOException;

import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryResponse;
import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.update.processor.UpdateRequestProcessor;
import org.apache.solr.update.processor.UpdateRequestProcessorFactory;

public class AddConditionalFieldsFactory extends
UpdateRequestProcessorFactory
{
  @Override
  public UpdateRequestProcessor getInstance(SolrQueryRequest req,
SolrQueryResponse rsp, UpdateRequestProcessor next)
  {
      System.out.println("From customization:");
    return new AddConditionalFields(next);
  }
}

class AddConditionalFields extends UpdateRequestProcessor
{
  public AddConditionalFields( UpdateRequestProcessor next) {

    super( next );
  }

  @Override
  public void processAdd(AddUpdateCommand cmd) throws IOException {
    SolrInputDocument doc = cmd.getSolrInputDocument();

    Object v = doc.getFieldValue( "url" );
    if( v != null ) {
      String url =  v.toString();
      if( url.contains("question") ) {
        doc.addField( "tierFilter", "1" );
      }
    }

    // pass it up the chain
    super.processAdd(cmd);
  }
}

Here is my Java code-
and I get the following error when I try to index-
Aug 20, 2011 10:48:43 AM org.apache.solr.common.SolrException log
SEVERE: java.lang.AbstractMethodError  at
org.apache.solr.update.processor.UpdateRequestProcessorChain.createProcessor(UpdateRequestProcessorChain.java:74)
        at
org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:53)

Any pointers please, I am using Solr 3.3

Thanks,
Bhawna

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