how to combine parent and children from Solr nested documents - solr

I'm new on lucence, solr queries, I have doubts about how to make a query to nested documents.
I have nested document indexed, as below
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
"title": "SolrCloud here as well"
}
]
}
]
How do I search title:SolrCloud, and listed all children's parents? Such as
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
}
]
}
]
}
]
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
"title": "SolrCloud here as well"
}
]
}
]
which listed all parents of document 4(Sorl1, Solr2, Solr3) and document 6(Solr5).
And the depth of documents is not constants.

My current solution is that massaging data, add trace into original data, so I will know document come from. such as
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
**"parent_id":"1",**
**"trace":"Solr1",**
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
**"parent_id":"2",**
**"trace":"Solr1/Solr2",**
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
**"parent_id":"3",**
**"trace":"Solr1/Solr2/Solr3",**
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
**"parent_id":"5",**
**"trace":"Solr5",**
"title": "SolrCloud here as well"
}
]
}
]
So after indexed, I could know who's parent document from result.
Could someone agree on this?
Looking for better solution than this.

Related

React Read a Apollo query Result (complex Array)

I've a little problem, fetch query over react to Graphql work.
But when I ask a complex query, I receive this answer :
How I can read all variable but not the variable in the "operation":
Name
ID
How I can read this 2 Variables ?
[
{
"__typename": "Journal",
"id": "1",
"name": "Journal1",
"state": "ACTIVE",
"operation": {
"__typename": "Operation",
"id": "1",
"name": "Oper1OnlyName"
}
},
{
"__typename": "Journal",
"id": "2",
"name": "Default",
"state": "ACTIVE",
"operation": {
"__typename": "Operation",
"id": "15",
"name": "Oper15ID"
}
},
{
"__typename": "Journal",
"id": "3",
"name": "Nachrichten",
"state": "ACTIVE",
"operation": {
"__typename": "Operation",
"id": "15",
"name": "Oper15ID"
}
},
{
"__typename": "Journal",
"id": "4",
"name": "WEMA",
"state": "ACTIVE",
"operation": null
},

Formatting data in table using react-bootstrap

I have a grouped object like below:
{
"L": [
{
"key": "0",
"name": "Bran"
},
{
"key": "6",
"name": "Janet"
},
{
"key": "18",
"name": "David"
},
{
"key": "20",
"name": "Sandy"
}
],
"P": [
{
"key": "5",
"name": "Emma"
},
{
"key": "4",
"name": "Helen"
}
],
"C": [
{
"key": "2",
"name": "Arthur"
}
]
}
The above object is dynamic with any no. of keys and values.
I would like to use react-bootstrap table to format the above data in a table like this:
L
P
C
Bran
Emma
Arthur
Janet
Helen
David
Sandy
If it can be easily achieved with react-bootstrap-table2, please suggest that too.
How would I achieve this?
Any help is appreciated. Thanks!

In Azure Search how can I filter records that have tags with IDs matching any in a list

Given the following search index document schema:
{
"value": [
{
"Id": "abc",
"Name": "Some name",
"Tags": [
{
"Id": "123",
"Name": "Tag123"
},
{
"Id": "456",
"Name": "Tag456"
}
]
},
{
"Id": "xyz",
"Name": "Some name",
"Tags": [
{
"Id": "123",
"Name": "Tag123"
},
{
"Id": "789",
"Name": "Tag789"
}
]
},
]
}
What is the correct syntax for an OData query that will return all records with any Tag/Ids that are contained in input list?
The closest I have got is:
Tags/any(object: object/Id search.in ('123,456,789'))

Docusign Send Multiple Envelope to multiple Signer with one to one Document to Signer mapping

I have been working on Salesforce to Docusign Integration. I have multiple documents with Specific signer for each document i.e. one document should be send to one specific user, not all. But I want to do this in one Rest API call to docusign! The documents are stored in Accounts attachments which are created dynamically for each user which are specific to user.
I have been trying this using CompositeTemplates, what I am doing is, adding document and Signer in each inlineTemplate, But it is sending all the documents to all the users in sequence.
I don't want to show all document to all the user, they should see only document specific to them.
Below is the JSON which I am sending:
{
"status": "Sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 1",
"recipientId": "1",
"name": "Anmol",
"email": "test#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test1"
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": "JVBERi0xLjQKJeLjz9MKN58HkeCg8gJEomcWGJdEFtOYYklsXV2dlT6R6Owc+FXFMNSlpckKM6M/ioTGkROkEjkxBDrgthySkvMxGpQJYapHKWwcwXtRU9GCg=="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "1"
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 2",
"recipientId": "1",
"name": "Anmol",
"email": "test1#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test2"
},
"documents": [
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": "JVBERi0xLjYNJeLjz9MNCjEzIDAgb2JqDTw8L0xpbmVhcmlmDQoxMTYNCiUlRU9GDQo="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "2"
}
]
}
Any doc, code or suggestions about the approach I am following for this will be very helpful.
To do it in a single api call, specify the excludedDocuments property in the EnvelopeCreate request
excludedDocuments: Specifies the documents that are not visible to the recipient. Document Visibility must be enabled for the account and the enforceSignerVisibility property must be set to true for the envelope to use this.
Here is a sample Json for POST /v2/accounts/{accountId}/envelopes
Note: I have combined both your inline templates into a single inlineTemplate.
{
"status": "Sent",
"emailSubject": "Email Subject to all recipients",
"emailBlurb": "Email body to all recipients",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"recipientId": "1",
"name": "recipient one",
"email": "recipientone#dsxtr.com",
"excludedDocuments": [ "2" ]
},
{
"recipientId": "2",
"name": "recipient two",
"email": "recipienttwo#dsxtr.com",
"excludedDocuments": [ "1" ]
}
]
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": ""
},
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": ""
}
]
}
],
"compositeTemplateId": "1"
}
]
}
I believe you're looking for documentVisibility on the create envelope call.
There are other supporting documentVisibility endpoints here.

Filtering JSON data in a list

I am new to working with JSON data. I am having difficulty on how to return back bicycles that have a color of "Blue". Using JSONPath.
The following example JSON file.
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
"bicycle": [
{
"price": 19.95
"color": [
"red"
],
},
{
"price": 20.99
"color": [
"blue",
"Green"
],
},
]
}
}
I have tried to use the following filter but it doesn't work.
$.store.bicycle[?(#.color=='blue')]
Any ideas to how to get this to work and only return the price of bicycles that are Blue?
Any information is greatly welcomed.
The JSON Data is
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}],
"bicycle": [
{
"price": 19.95,
"color": [
"red"
]
},
{
"price": 20.99,
"color": [
"blue",
"Green"
]
}
]
}
}
The JSONPath is
$.store.bicycle[?(#.color.indexOf('blue') != -1)]

Resources