I had a look to the source code and I see
DocBasedVersionConstraintsProcessorFactory

if (0 < ((Comparable)newUserVersion).compareTo((Comparable)
oldUserVersion)) {
          // log.info("VERSION returning true (proceed with update)" );
          return true;
}

I can't find a way of overwriting same version without changing that piece
of code.
Would be possible to add a parameter to the
"DocBasedVersionConstraintsProcessorFactory" something like
"overwrite.same.version=true"
so the new code would look like.


int compareTo = ((Comparable)newUserVersion).compareTo((Comparable)
oldUserVersion);
if ( ((overwritesameversion) && 0 <= compareTo) || (0 < compareTo)) {
          // log.info("VERSION returning true (proceed with update)" );
          return true;
}


Is that thing going to break anyhting? Can i do that change?

Thanks
Sergio


On 2 June 2017 at 10:10, Sergio García Maroto <marot...@gmail.com> wrote:

> I am using  6.1.0.
> I tried with two different  field types, long and date.
> <field name="versionEpoch"  type="long" indexed="true" stored="true" />
> <field name="UpdatedDateSD"  type="date" indexed="true" stored="true"/>
>
> I am using this configuration on the solrconfig.xml
>
> <updateRequestProcessorChain default="true">
>        <processor class="solr.DocBasedVersionConstraintsProcessorFactory">
>          <bool name="ignoreOldUpdates">false</bool>
>          <str name="versionField">UpdatedDateSD</str>
>        </processor>
>   <processor class="solr.DistributedUpdateProcessorFactory" />
>        <processor class="solr.RunUpdateProcessorFactory" />
>   <processor class="solr.LogUpdateProcessorFactory"/>
>   </updateRequestProcessorChain>
>
> i had a look to the wiki page and it says https://cwiki.apache.org/
> confluence/display/solr/Updating+Parts+of+Documents
>
> *Once configured, this update processor will reject (HTTP error code 409)
> any attempt to update an existing document where the value of
> the my_version_l field in the "new" document is not greater then the value
> of that field in the existing document.*
>
> Do you have any tip on how to get same versions not getting rejected.
>
> Thanks a lot.
>
>
> On 1 June 2017 at 19:04, Susheel Kumar <susheel2...@gmail.com> wrote:
>
>> Which version of solr are you using? I tested in 6.0 and if I supply same
>> version, it overwrite/update the document exactly as per the wiki
>> documentation.
>>
>> Thanks,
>> Susheel
>>
>> On Thu, Jun 1, 2017 at 7:57 AM, marotosg <marot...@gmail.com> wrote:
>>
>> > Thanks a lot Susheel.
>> > I see this is actually what I need.  I have been testing it and  notice
>> the
>> > value of the field has to be always greater for a new document to get
>> > indexed. if you send the same version number it doesn't work.
>> >
>> > Is it possible somehow to overwrite documents with the same version?
>> >
>> > Thanks
>> >
>> >
>> >
>> > --
>> > View this message in context: http://lucene.472066.n3.
>> > nabble.com/version-Versioning-using-timespan-tp4338171p4338475.html
>> > Sent from the Solr - User mailing list archive at Nabble.com.
>> >
>>
>
>

Reply via email to