Solr schema - Conflicting wildcards for fields - indexing

I am indexing data from MongoDB that roughly looks like
{
"name": "John Doe",
"age": "25",
"education": [
{
"title": "Masters",
"status": 53,
"finalProject": {
"title": "Integrating Advanced STJs using KKO",
"status": "In Progress"
}
},
{
"title": "Software Engineering",
"status": 52,
"finalProject": {
"title": "Use of LPI in Multi-sanctioned BPDs",
"status": "Completed"
}
},
{
"title": "Pre-Engineering",
"status": 51
},
{
"title": "Matriculation",
"status": 52
}
]
}
Notice that I have got two status fields; one at education.*.status which is integer and the other at education.*.finalProject.status. How can I specify copyFields for both?
I considered specifying them as follows in my schema
<field name="projectStatus" type="string" stored="true" indexed="true" multiValued="true"/>
<copyField source="*.finalProject.status" dest="projectStatus"/>
<field name="educationStatus" type="int" stored="true" indexed="true" multiValued="true"/>
<copyField source="*.status" dest="educationStatus"/>
but both the patterns seem to be conflicting as *.status already covers *.finalProject.status. How can I specify them both in separate copy fields?

Related

Send Commerce Manager catalog product using WhatsApp Cloud API

After successfully adding my catalog from Commerce manager to Whatsapp manager, now I want to send the user this product via WhatsApp cloud API, I have seen the link which is related to the on-permises API, but found no luck.
https://developers.facebook.com/docs/whatsapp/guides/commerce-guides/share-products-with-customers.
my request body code so far:
https://graph.facebook.com/v13.0/{{Phone-Number-ID}}/messages
{
"interactive": {
"messaging_product": "whatsapp",
"to": "9***********",
"type": "product",
"body": {
"text": "text-body-content"
},
"footer": {
"text": "text-footer-content"
},
"action": {
"catalog_id": "11111111111111",
"product_retailer_id": "2222"
}
}
}
error:
{
"error": {
"message": "(#100) The parameter messaging_product is required.",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AZ-AFvM-Nsnm62de34st5mMJxzJ"
}
}
another request
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to" : "**********",
"type": "interactive",
"interactive": {
"type": "product",
"body": {
"text": "body text"
},
"footer": {
"text": "footer text"
},
"action": {
"catalog_id": "1968701893374783",
"product_retailer_id": "5493"
}
}
}
Result: {
"error": {
"message": "(#131009) Parameter value is not valid",
"type": "OAuthException",
"code": 131009,
"error_data": {
"messaging_product": "whatsapp",
"details": "Interactive Message type, 'product' not supported. Supported types ['button', 'list']"
},
"error_subcode": 2494010,
"fbtrace_id": "AntQdhmCkgZ0Xtaz643Bgq"
}
}
Update:
It is supporting from Aug 25, 2022,
You can now include products and services in messages sent to customers, and customers can add them to shopping carts without having to leave the chat thread. Refer to the Sell Products & Services guide to learn how to send Single and Multi-Product messages to customers.
There is no support for product and product_list types in Cloud API, but you can use it in On-Premises API,
Might be it is still in development, You can track the conversations in Facebook Community,
1094784808057904
415039447294216
data = {
"messaging_product": "whatsapp",
"to": m_id,
"type": "interactive",
"interactive":
{
"type": "product_list",
"header": {
"type": "text",
"text": "header text"
},
"body": {
"text": "body text"
},
"footer": {
"text": "footer text"
},
"action": {
"catalog_id": "catalog id",
"sections": [
{
"title": "section title",
"product_items": [
{"product_retailer_id": "product id"},
]},
{
"title": "section title",
"product_items": [
{"product_retailer_id": "product id"},
]},
]
},
}
}

Splunk Dashboard Studio, Tokens behaviour with chained searches

Since the last Splunk update I've noticed some unexpected behavior when it comes to tokens with Splunk Dashboard Studio.
If you have an input (dropdown or multiselect) with a default value set to None.
After loading the dashboard page, then setting the input value,
The base searches in the dashboard that use the input token will update,
but any chain searches of that base search do not.
It does however update if you either refresh the page with the tokens set in the url, or a change to the input for a second time. (any other action which causes the page to refresh in some way eg: editing page will update the dashboard and the chain search will update)
is this behaviour a bug, and is there currently a way to fix this behaviour?
Thanks Daniel
Below is a self contained minimal example to demonstrate this.
Splunk Dashboard Studio: Absolute/Full control layout
{
"visualizations": {
"viz_cdPoxmBV": {
"type": "splunk.table",
"dataSources": {
"primary": "ds_CJTH14Fk"
},
"title": "Base"
},
"viz_t4aAHmKH": {
"type": "splunk.table",
"title": "Chain",
"dataSources": {
"primary": "ds_aqLh17e3"
}
}
},
"dataSources": {
"ds_CJTH14Fk": {
"type": "ds.search",
"options": {
"query": "| makeresults\n| eval a=\"$input$\"\n| table a ",
"queryParameters": {
"earliest": "0",
"latest": ""
}
},
"name": "Search_Base"
},
"ds_aqLh17e3": {
"type": "ds.chain",
"options": {
"extend": "ds_CJTH14Fk",
"query": "| eval a=a+\"_END\""
},
"name": "Search_1"
}
},
"defaults": {
"dataSources": {
"ds.search": {
"options": {
"queryParameters": {
"latest": "$global_time.latest$",
"earliest": "$global_time.earliest$"
}
}
}
}
},
"inputs": {
"input_aXQ6s8I2": {
"options": {
"items": [
{
"label": "All",
"value": "*"
},
{
"label": "Item 1",
"value": "item001"
},
{
"label": "Item 2",
"value": "item002"
}
],
"token": "input"
},
"title": "Dropdown Input Title",
"type": "input.dropdown"
}
},
"layout": {
"type": "absolute",
"options": {
"display": "auto-scale"
},
"structure": [
{
"item": "viz_cdPoxmBV",
"type": "block",
"position": {
"x": 10,
"y": 10,
"w": 410,
"h": 140
}
},
{
"item": "viz_t4aAHmKH",
"type": "block",
"position": {
"x": 430,
"y": 10,
"w": 400,
"h": 140
}
}
],
"globalInputs": [
"input_aXQ6s8I2"
]
},
"description": "",
"title": "Test_Token"
}
below is classic dashboard example where behaviour is not seen.
<form version="1.1">
<label>Test_Token</label>
<search id="baseSearch">
<query>| makeresults
| eval a="$input$"
| table a</query>
<earliest>-24h#h</earliest>
<latest>now</latest>
</search>
<fieldset submitButton="false">
<input type="dropdown" token="input">
<label>dropdown</label>
<choice value="*">All</choice>
<choice value="item001">Item 1</choice>
<choice value="item002">Item 2</choice>
</input>
</fieldset>
<row>
<panel>
<table>
<search>
<query>| makeresults
| eval a="$input$"
| table a</query>
<earliest>-24h#h</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
</table>
</panel>
</row>
<row>
<panel>
<table>
<search base="baseSearch">
<query>| eval a=a+"_END"</query>
</search>
<option name="drilldown">none</option>
</table>
</panel>
</row>
</form>

Apache solr 7.4 : "copyField dest :'text' is not an explicit field and doesn't match a dynamicField

I am using Apache Solr 7.4. I am trying to use curl/postman to define some portions of my schema.
I was able to define field type and fields successfully, when I try to define a copy-field I am getting an error :
"copyField dest :'text' is not an explicit field and doesn't match a dynamicField
Here's my field type definition :
"add-field-type": {
"name": "text",
"class": "solr.TextField",
"positionIncrementGap": "100",
"indexAnalyzer": {
"charFilters": [{
"class": "solr.MappingCharFilterFactory",
"mapping": "mapping-ISOLatin1Accent.txt"
}],
"tokenizer": {
"class": "solr.KeywordTokenizerFactory"
},
"filters": [{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.StopFilterFactory",
"ignoreCase": "true",
"words": "stopwords.txt"
},
{
"class": "solr.RemoveDuplicatesTokenFilterFactory"
}
]
},
"queryAnalyzer": {
"charFilters": [{
"class": "solr.MappingCharFilterFactory",
"mapping": "mapping-ISOLatin1Accent.txt"
}],
"tokenizer": {
"class": "solr.KeywordTokenizerFactory"
},
"filters": [{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.StopFilterFactory",
"ignoreCase": "true",
"words": "stopwords.txt"
},
{
"class": "solr.LowerCaseFilterFactory"
},
{
"class": "solr.RemoveDuplicatesTokenFilterFactory"
}
]
}
}
I also added a dynamic field :
"add-dynamic-field":{
"name":"*_txt1",
"type":"text",
"stored":true,
"indexed":true
}
Here's my field :
"add-field": [{
"name": "path",
"type": "string",
"indexed": "true",
"stored": "false"
}
Its successful upto this. Now I am trying to add a copy field as below :
"add-copy-field":
{
"source":"path",
"dest": "text"
}
And this is where it is failing. Stuck at this, any help is appreciated. Thanks!
Your destination for copy field are wrong.
“dest”: “text”
You don’t have any field with “text” name, only field type with “text” name.
Make sure you have all the source and destination fields before making the copy fields.
For example if you want to copy two source fields to the destination field. Make sure all of those fields exist first.
<field name="destination" type="text" indexed="true" stored="true" required="false"/>
<field name="source1" type="text" indexed="false" stored="true" required="false" />
<field name="source2" type="text" indexed="false" stored="true" required="false" />
Then only you can make copy fields.
<copyField source="source1" dest="destination"/>
<copyField source="source2" dest="destination"/>

How to store all the json objects from an iterator into one Array in wso2 ESB

I have an json output which looks like,
"details": [
{
"id": "",
"name": "",
"status": "",
},
{
"id": "",
"name": "",
"status": "",
},
{
"id": "",
"name": "",
"status": "",
},
{
"id": "",
"name": "",
"status": "",
}
From this output I can iterate values like //jsonObject/details and fetching individual item like
json-eval('$.details.id'), but I want to store all Id's and Name's into a Array in wso2 ESB, from the output I get, Can anyone help me.
Not sure if that helps, I think the following pseydo code might do it but I haven't tried it.
//create an empty var
<property name="newArray" value=""/>
//iterate over the json
<iterate xmlns:ns="http://org.apache.synapse/xsd" continueParent="true" expression="//jsonObjects/object" id="MyIterator">
....
<property name="newArray" expression="fn:concat(get-property('newArray'),//jsonObjects/object/value)" scope="operation"/>
....
</iterate>
<log>
<property name="afterIterate" expression="get-property('operation','newArray')"/>
</log>

HTTP Post with ContentURL

I a using Microsoft Bot Framework and am trying to do a HTTP Post with an image sent to the bot as an attachment. I see a ContentURL in the Attachment object but cannot figure out how to POST the image to my API with RestSharp?
Any Ideas?
There are a couple possibilities here.
First is to send an image as an attachment. Please see this documentation you JSON would look like this:
{
"type": "message",
"from": {
"id": "12345678",
"name": "sender's name"
},
"conversation": {
"id": "abcd1234",
"name": "conversation's name"
},
"recipient": {
"id": "1234abcd",
"name": "recipient's name"
},
"text": "Here's a picture of the duck I was telling you about.",
"attachments": [
{
"contentType": "image/png",
"contentUrl": "http://aka.ms/Fo983c",
"name": "duck-on-a-rock.jpg"
}
],
"replyToId": "5d5cdc723
}
the other possibility is that you could send an image in a card (which has 2 possibilities itself). For this you can see this documentation for rich cards. in this here is an example of the JSON for that
{
"type": "message",
"from": {
"id": "12345678",
"name": "sender's name"
},
"conversation": {
"id": "abcd1234",
"name": "conversation's name"
},
"recipient": {
"id": "1234abcd",
"name": "recipient's name"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.hero",
"content": {
"title": "title goes here",
"subtitle": "subtitle goes here",
"text": "descriptive text goes here",
"images": [
{
"url": "http://aka.ms/Fo983c",
"alt": "picture of a duck",
"tap": {
"type": "playAudio",
"value": "url to an audio track of a duck call goes here"
}
}
],
"buttons": [
{
"type": "playAudio",
"title": "Duck Call",
"value": "url to an audio track of a duck call goes here"
},
{
"type": "openUrl",
"title": "Watch Video",
"image": "http://aka.ms/Fo983c",
"value": "url goes here of the duck in flight"
}
]
}
}
],
"replyToId": "5d5cdc723"
}
the second option for cards would be adaptive cards. by using the visualizer you can actually manipulate the JSON and see how it would be rendered in different channels.