I see the difference now between using _version_ vs custom versionField.
Both seems to behave differently.  The _version_ field if used allows same
version to be updated and that's the perception I had in mind for custom
versionField.

My question is why do you want to update the document if same version.
Shouldn't you pass higher version if the doc has changed and that makes the
update to be accepted ?

On Fri, Jun 2, 2017 at 8:13 AM, Susheel Kumar <susheel2...@gmail.com> wrote:

> Just to confirm again before go too far,  are you able to execute these
> examples and see same output given under "Optimistic Concurrency".
> https://cwiki.apache.org/confluence/display/solr/
> Updating+Parts+of+Documents#UpdatingPartsofDocuments-In-PlaceUpdates
>
> Let me know which example you fail to get same output as described in.
>
> On Fri, Jun 2, 2017 at 5:11 AM, Sergio García Maroto <marot...@gmail.com>
> wrote:
>
>> 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.DocBasedVersionCon
>> straintsProcessorFactory">
>> >          <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