I am attempting to write a script for the ScriptingUpdateProcessor. In the JSON 
below I want to pull out the objects in the "Fields" array and create fields 
for them based on the values provided in the object.
However, if I attempt to iterate over the fields in the solrDoc like this:
doc = cmd.solrDoc;
field_names = doc.getFieldNames().toArray();
  for(i=0; i < field_names.length; i++) { ...

I will find the first item in the array but none of the subsequent ones.

How can I access this array so that my script can process it?

I attempted to  use rsp.getJSON(); but his returns null.

Thank you for any insight.



{
  "doc_id": "45",
  "content": {
    "Page": {
      "Id": "2ff99d1a-a21b-4391-9c47-af2865acb753",
      "Name": "Ronald McDonald House Idaho meals",
      "Url": 
"/blogs/st-lukes/news-and-community/2021/jan/ronald-mcdonald-house-idaho-meals",
      "ContentType": "Blog",
      "Body": {
        "Fields": [
          {"Name": "Heading Background Image", "Type": "Image", "Value": "" },
          {"Name": "Blog Post Name", "Type": "Single-Line Text", "Value": 
"Ronald McDonald House, St. Luke’s Children’s find new ways to help families" }
        ],
        "Facets": ["Blogs", "Article"],
        "Title": "Ronald McDonald House, St. Luke’s Children’s find new ways to 
help families",
        "Summary": ""
      }
    }
  }
}

            
      

----------------------------------------------------------------------
"This message is intended for the use of the person or entity to which it is 
addressed and may contain information that is confidential or privileged, the 
disclosure of which is governed by applicable law. If the reader of this 
message is not the intended recipient, you are hereby notified that any 
dissemination, distribution, or copying of this information is strictly 
prohibited. If you have received this message by error, please notify us 
immediately and destroy the related message."

Reply via email to