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

/update/json/docs should have nested document support

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.1, 7.0
    • None

    Description

      It is the next logical step after SOLR-6304
      For the example document given below where the /orgs belong to a nested document,

      {
      name: 'Joe Smith',
      phone: 876876687 ,
      orgs :[ {name : Microsoft,
                city: "Seattle,
                zip: 98052},
              {name: Apple,
               city : Cupertino,
               zip :95014 }
            ]
      } 
      

      The extra mapping parameters would be

      split=/|/orgs&
      f=name:/orgs/name&
      f=city:/orgs/city&
      f=zip:/orgs/zip
      
      • The objects at /org automatically becomes a child document because /org is a child path of{{/}}
      • All fields falling under the /orgs/ will be mapped to the child document

      alternately you can just do

      split=/|/orgs&f=$FQN:/**
      

      The fully qualified name (FQN) for chiild docs begin from /org. So the output would be

      {
        "name":"Joe Smith",
        "phone":876876687,
        "_childDocuments_":[
          {
            "name":"Microsoft",
            "city":"Seattle",
            "zip":98052},
          {
            "name":"Apple",
            "city":"Cupertino",
            "zip":95014}]}
      

      Attachments

        1. SOLR-7123-test.patch
          2 kB
          Anshum Gupta
        2. SOLR-7123.patch
          16 kB
          Noble Paul
        3. NestedDocumentMapper.java
          3 kB
          Timothy Potter
        4. SOLR-7123.patch
          6 kB
          Vitaliy Zhovtyuk

        Issue Links

          Activity

            People

              noble.paul Noble Paul
              noble.paul Noble Paul
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: