: It looks strange to me that if there is no document yet (foundVersion < 0)
: then the only case when document will be imported is when input version is
: negative. Guess I need to test specific cases using SolrJ or smth. to be sure.

you're assuming that if foundVersion < 0 that means no document *yet* ... 
it could also mean there was a document, and it's been deleted.

Either way if the client has said "(replace|update) version X of doc D" 
the code is failing because it can't: doc D does not exist with version 
X.  Regardless of whether someone deleted doc D, or replaced it it with a 
newer version, or it never existed i nthe first place, Solr can't do what 
you asked it to do.

: Anyway I'll also check if I can inherit from SolrEntityProcessor and override
: _version_ field there before insertion.

Easier solutions to consider (off the cuff, not tested)...

1) on in your SolrEntityProcessor, configure fl with something like this 
to alias the _version_ field to something else

   fl=*,old_version:_version_

2) configure your destination solr instance with an update chain that 
ignores the _version_ field (you wouldn't want this for most normal usage, 
but it would be suitable for thiese conds of from scratch imports from 
other solr instances)...

https://lucene.apache.org/solr/4_2_0/solr-core/org/apache/solr/update/processor/IgnoreFieldUpdateProcessorFactory.html



-Hoss

Reply via email to