You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Amrit Sarkar (JIRA)" <ji...@apache.org> on 2017/03/03 23:09:45 UTC

[jira] [Commented] (SOLR-9838) atomic "inc" when adding doc doesn't respect field "default" from schema

    [ https://issues.apache.org/jira/browse/SOLR-9838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15895218#comment-15895218 ] 

Amrit Sarkar commented on SOLR-9838:
------------------------------------

The troubled code is in AtomicUpdateDocumentMerger.java::doInc(..) :

{noformat}
  protected void doInc(SolrInputDocument toDoc, SolrInputField sif, Object fieldVal) {
    SolrInputField numericField = toDoc.get(sif.getName());
    if (numericField == null) {
      toDoc.setField(sif.getName(),  fieldVal); //need to check the default in schema here, instead just putting whatever is coming
    } else {
     ...................................................................
  }
{noformat}

I will try to cook up a patch for the same with relevant test cases.

> atomic "inc" when adding doc doesn't respect field "default" from schema
> ------------------------------------------------------------------------
>
>                 Key: SOLR-9838
>                 URL: https://issues.apache.org/jira/browse/SOLR-9838
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>
> If you do an "atomic update" when adding a document for the first time, then the "inc" operator acts as if the field has a default of 0.
> But if the {{<field/>}} has an *actual* default in the schema.xml (example: {{default="42"}}) then that default is ignored by the atomic update code path.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org