Peter,

I think you can override org.apache.solr.handler.dataimport.SolrWriter to have 
a custom (no-op) rollback method.  Your new writer should implement 
org.apache.solr.handler.dataimport.DIHWriter.  You can specify the "writerImpl" 
request parameter to specify the new class.

Unfortunately, it isn't actually this easy because your new writer is going to 
have to know what to do for all the other methods.  That is, there is no easy 
way to tell it how to write/commit/etc to Solr.  The default SolrWriter has a 
lot of hardcoded parameters it gets sent on construction in 
DataImportHandler#handleRequestBody.  You would have to somehow duplicate this 
construction on your own custom class.  See SOLR-3671 for an explanation of 
this dilemma.

James Dyer
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: pkeegan01...@gmail.com [mailto:pkeegan01...@gmail.com] On Behalf Of Peter 
Keegan
Sent: Friday, January 17, 2014 7:51 AM
To: solr-user@lucene.apache.org
Subject: Re: How to override rollback behavior in DIH

Following up on this a bit - my main index is updated by a SolrJ client in
another process. If the DIH fails, the SolrJ client is never informed of
the index rollback, and any pending updates are lost. For now, I've made
sure that the DIH processor never throws an exception, but this makes it a
bit harder to detect the failure via the admin interface.

Thanks,
Peter


On Tue, Jan 14, 2014 at 11:12 AM, Peter Keegan <peterlkee...@gmail.com>wrote:

> I have a custom data import handler that creates an ExternalFileField from
> a source that is different from the main index. If the import fails (in my
> case, a connection refused in URLDataSource), I don't want to roll back any
> uncommitted changes to the main index. However, this seems to be the
> default behavior. Is there a way to override the IndexWriter rollback?
>
> Thanks,
> Peter
>

Reply via email to