Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12167

Child documents are ignored if unknown atomic operation specified in parent doc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.1, 9.0
    • update
    • None

    Description

      On trying to add this nested document,

      {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:""}
       }
      

      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.

      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
        {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."
            }
          ]
         }
        

        Here, nested document is indexed and labelinfo field value indexed in book6_c1 as string(using Map.toString())

      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

      Attachments

        1. SOLR-12167.patch
          6 kB
          Munendra S N

        Issue Links

          Activity

            People

              ichattopadhyaya Ishan Chattopadhyaya
              munendrasn Munendra S N
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: