In our previous blog, we saw how to use some optional parameters. This blog will be a continuation of the same. In this blog, we will look at other optional parameters to limit the search per our requirements. So, without further ado, let’s get started.
Now, first, for the additional parameter, we will look at facets.
facets – With this optional parameter, we can further drill down into the search results based on the information that we want. So, continuing with the same example, after searching for Jim, we need to quickly see how many records are there in our CRM according to the entity type. Here, I want to drill down using the entity name for which the syntax would be – “@search.entityname”. Since the body of the HTTP request cannot directly use ‘@,’ we have to use a workaround here. We will use the concat() function of Power Automate and the resultant syntax would be as below –
filter – This is another optional parameter that is used to filter out the records. Unlike facets, a filter will be applied with the query and the results will be based on the criteria defined in the filter query. If multiple types of entity records are returned, the filter should contain separate filters for every entity. In the below example, I’m filtering the contacts that have city Detroit & accounts that have city, Brooklyn. The syntax is as below –
searchmode – This is another optional parameter that can have a value of either any or all. Any will return the values matching any of the conditions in the search query while all will return all records which match both the search query parameters. “Jim -Harper” will return all the records that either contain Jim or don’t contain Harper with searchmode ‘any’, while searchmode ‘all’ will return the records that contain Jim and don’t contain Harper. The syntax is as below –
searchtype – This is another optional parameter that can have a value of either simple or full. ‘Simple’ only has a few functionalities supported while ‘full’ supports the functionalities of Lucene query syntax. The syntax is as below –
The differences between simple & full searchtypes are as follows:
Conclusion
This is how we can use optional parameters to limit the search as per our requirements.