Munendra S N created SOLR-12167:
-----------------------------------

             Summary: Child documents are ignored if unknown atomic operation 
specified in parent doc
                 Key: SOLR-12167
                 URL: https://issues.apache.org/jira/browse/SOLR-12167
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: update
            Reporter: Munendra S N


On trying to add this nested document,
{code:java}
{uniqueId : book6, type_s:book, title_t : "The Way of Kings", author_s : 
"Brandon Sanderson",
  cat_s:fantasy, pubyear_i:2010, publisher_s:Tor, parent_unbxd:true,
  _childDocuments_ : [
    { uniqueId: book6_c1, type_s:review, 
review_dt:"2015-01-03T14:30:00Z",parentId : book6,
      stars_i:5, author_s:rahul,
      comment_t:"A great start to what looks like an epic series!"
    }
    ,
    { uniqueId: book6_c2, type_s:review, 
review_dt:"2014-03-15T12:00:00Z",parentId : book6,
      stars_i:3, author_s:arpan,
      comment_t:"This book was too long."
    }
  ],labelinfo:{label_image:"",hotdeal_type:"",apply_hotdeal:""}
 }
{code}
Only parent document is getting indexed(without labelinfo field) and child 
documents are being ingored.

On checking the code,
https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/update/processor/AtomicUpdateDocumentMerger.java#L94
 
I realized that since *labelinfo* is a Map, Solr is trying for atomic updates 
and since label_image, hotdeal_type, apply_hotdeal are invalid operation field 
is ignored. Unfortunately, child documents are also not getting indexed.

h4. Problem with current behavior:
* field is silently ignored when its value is a map instead of failing document 
update(when present in parent)
* In the above case, child document is also getting ignored
* If any field value is Map in child document but not in parent then nested 
document is indexed properly
{code:java}
{uniqueId : book6, type_s:book, title_t : "The Way of Kings", author_s : 
"Brandon Sanderson",
  cat_s:fantasy, pubyear_i:2010, publisher_s:Tor, parent_unbxd:true,
  _childDocuments_ : [
    { uniqueId: book6_c1, type_s:review, 
review_dt:"2015-01-03T14:30:00Z",parentId : book6,
      stars_i:5, author_s:rahul,
      comment_t:"A great start to what looks like an epic series!"
,labelinfo:{label_image:"","hotdeal_type":"","apply_hotdeal":""}
    }
    ,
    { uniqueId: book6_c2, type_s:review, 
review_dt:"2014-03-15T12:00:00Z",parentId : book6,
      stars_i:3, author_s:arpan,
      comment_t:"This book was too long."
    }
  ]
 }
{code}
Here, nested document is indexed and labelinfo field value indexed in book6_c1 
as string(using Map.toString())

h4. Probable solution
* If an unknown operation is specified in update document then instead of 
ignoring the field and field value, fail the document update(fail fast 
approach). So, that user would know something is wrong with the document. Also, 
this would solve the case where the parent doc is getting indexed and child 
documents are getting ignored
* Currently, when child document's field value is a Map even then it gets 
indexed, instead update should fail



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to