So, one answer here is to use the split parameter. This creates multiple documents which I believe is the intention.
However, this reveals a number of really strange behaviors when used in combination with a script in the updateRequest ProcesseserChain It appears that processAdd(cmd) is run for each document created but not the other functions. The problem that arises is in attempting to find fields to add in all these documents. If I save them in the scope of the overall script they get saved, however if I attempt to add them in another of the required functions, that is only run once (oddly enough) the addField method cannot be accessed, it throws an error thinking it is a property. If I add the field in the processAdd() function, they get added n! times because the dictionary gets bigger each time. If I attempt to add just one field for each time processAdd() runs only the last field actually gets added. I am getting the result that I wanted but really would like to know how to make this happen with adding the fields n! times! In the end, I have one document added that has my new fields found and processed in the script, but it seems to have very poor performance indexing due to the reasons above. Is it the intention that the addField() method only accessible in the processAdd() function? ________________________________ From: Matthew Castrigno <castr...@slhs.org> Sent: Thursday, November 17, 2022 4:40 PM To: users@solr.apache.org <users@solr.apache.org> Subject: accessing an array of objects in a JSON payload. 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 ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside the St. Luke's email system. ZjQcmQRYFpfptBannerEnd 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." ---------------------------------------------------------------------- "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."