GETTING STARTED
SearchAssist Overview
SearchAssist Introduction
Onboarding SearchAssist
Build your first App
Glossary
Release Notes
What's new in SearchAssist
Previous Versions

CONCEPTS
Managing Sources
Introduction
Files
Web Pages
FAQs
Structured Data 
Connectors
Introduction to Connectors
SharePoint Connector
Confluence Cloud Connector
Confluence Server Connector
Zendesk Connector
ServiceNow Connector
Salesforce Connector
Azure Storage Connector
Google Drive Connector
Dropbox Connector
Oracle Knowledge Connector
DotCMS Connector
RACL
Virtual Assistants
Managing Indices
Introduction
Index Fields
Traits
Workbench
Introduction to Workbench
Field Mapping
Entity Extraction
Traits Extraction
Keyword Extraction
Exclude Document
Semantic Meaning
Snippet Extraction
Custom LLM Prompts
Index Settings
Index Languages
Managing Chunks
Chunk Browser
Managing Relevance
Introduction
Weights
Highlighting
Presentable
Synonyms
Stop Words
Search Relevance
Spell Correction
Prefix Search
Custom Configurations
Personalizing Results
Introduction
Answer Snippets
Introduction
Extractive Model
Generative Model
Enabling Both Models
Simulation and Testing
Debugging
Best Practices and Points to Remember
Troubleshooting Answers
Answer Snippets Support Across Content Sources
Result Ranking
Facets
Business Rules
Introduction
Contextual Rules
NLP Rules
Engagement
Small Talk
Bot Actions
Designing Search Experience
Introduction
Search Interface
Result Templates
Testing
Preview and Test
Debug Tool
Running Experiments
Introduction
Experiments
Analyzing Search Performance
Overview
Dashboard
User Engagement
Search Insights
Result Insights
Answer Insights

ADMINISTRATION
General Settings
Credentials
Channels
Team
Collaboration
Integrations
OpenAI Integration
Azure OpenAI Integration
Custom Integration
Billing and Usage
Plan Details
Usage Logs
Order and Invoices

SearchAssist APIs
API Introduction
API List

SearchAssist SDK

HOW TOs
Use Custom Fields to Filter Search Results and Answers
Add Custom Metadata to Ingested Content
Write Painless Scripts
Configure Business Rules for Generative Answers

Advanced Search API

This API fetches search results and answers generated corresponding to the input query and the filters sent in the request body. This API returns results from all the data ingested into the SearchAssist application. You can sort the results, limit the number of search results, send additional search settings or request for qualified chunks for the generated answer using appropriate options in the request payload.  

Method POST
Endpoint <host_url>/searchassistapi/external/stream/<streamId>/advancedSearch
Content-Type application/json
Authorization auth: <JWT Token>
API Scope Advanced Search

Query Parameters

Parameters Description Mandatory
Stream ID Provide your application ID here. 
skip This is the number of index records to skip while fetching the records.  No. When not provided, the default value of 0 is used. 
limit This is the number of index records to be fetched in each API call.  No. When not provided, the default value of 50 is used.

Request Parameters

Parameters Description Mandatory
query Query string for search Yes
queryType This parameter can take one of the following two values:

  • relevanceWithMetaFilter – when queryType is set to this value, SearchAssist processes the results as per the metaFilters in the request object.
  • Relevance – If queryType is set to relevance, the metaFilters are ignored.
No
metaFilters This parameter can be used to define rules to filter out the search results. This parameter takes an array of rules with conditions. For example, in the following sample, we are adding a filter which has two rules that help you choose either the products . 

 "metaFilters": [
   {
       "condition": "OR",
       "rules": [
         {
               "fieldName": "productType",
               "fieldValue": [
                                  "washing machines"
                 ],
               "operator": "contains"
          },
          {
            "fieldName": "price",
             "fieldValue": [
              {
                     "lte": "15"
              }
              ],
              "operator": "range"
             }
           ]
   },
]
No 
answerMetaFilters This parameter can be used to define rules to filter out the results from the Answer Index before using them for generating the answer. This parameter takes an array of rules with conditions. For example, in the following example, we are selecting chunks only where the source is ‘web’. 

 “answerMetaFilters”:
 [ {
  “condition”: “AND”,
  “rules”: [
    {
      “fieldName”: “sourceType”,
      “fieldValue”: [
        “web”
      ],
      “operator”: “contains”
    }
  ]
}]
No
sort This parameter can be used to sort the results as per the index fields. For example, to sort the results in ascending order of the title, set this to: 

"sort": [
{
"fieldName": "title",
"order": "asc"
}]
No 
lang The language used for the query. No. By default, this is set to English.
customData Custom data to be sent in the request. This data can be used to further process or filter the search results in the application.  For example, you can use this field to set user context like user identity, location, etc. No
SearchSettings Search settings to be applied to the fields. The default search configuration of the application is overridden when this parameter is present in the request body. No
maxNumOfResults Max number of search results to be returned in the response.  Yes
facets This parameter can be used to facets to refine the search results. Refer to the sample payload below for an example.  No 
answerSearch This can be set to true or false. When set to ‘true’, the response will include answers. Conversely, when set to ‘false’, the response will omit the answer to the query. However, you can still use the includeChunksinResponse field to see the qualified chunks in the response. By default, it is set to true.  No
includeChunksInResponse This can be set to true or false. When set to true and if answers snippets are enabled, the response will also have the list of qualified chunks along with other parameters. The chunk information is stored in chunk_result

field in the response. 

No

Sample Request payload 

{
  "query": "show me shirts less than $20",
  "maxNumOfResults": 20,
  "queryType": "relevanceWithMetaFilter",
  "customData": {
    "userContext": {
      "userId": "u-cdd39325-b89e-517b-b3d6-18b75a5f09a6"
    }
  },
  "sort": [
    {
      "fieldName": "title",
      "order": "asc"
    }
  ],
  "metaFilters": [
    {
      "condition": "OR",
      "rules": [
        {
          "fieldName": "productType",
          "fieldValue": [
            "jackets"
          ],
          "operator": "contains"
        },
        {
          "fieldName": "price",
          "fieldValue": [
            {
              "lte": "1500"
            }
          ],
          "operator": "range"
        }
      ]
    },
    {
      "condition": "AND",
      "rules": [
        {
          "fieldName": "productType",
          "fieldValue": [
            "shirts"
          ],
          "operator": "contains"
        },
        {
          "fieldName": "price",
          "fieldValue": [
            {
              "lte": 1500
            }
          ],
          "operator": "range"
        }
      ]
    }
  ],
  "facets": [
    {
      "name": "MensWear",
      "subtype": "value",
      "size": 10,
      "sortConfig": {
        "sortBy": "count",
        "order": "desc"
      },
      "fieldName": "productType"
    }
  ]
}

Response Format

Search Results are listed as results field in the response. Search results from different sources are separated by source name in the results field. If answerSearch is set to true, the answer for the given query is presented in the graph_answer field. If includeChunksInResponse is set to true, the chunk details are available in the chunk_result field. 

The format of the API response is as shown below. Note that the response format can vary depending on the request payload.


Tips on using customData parameter in the Search APIs

The parameter, customData, in the request object can be used to send custom data to the SearchAssist application. This field can be used to set the userContext when performing the search through APIs. For example, if your search results depend on the location of the user and you have a business rule in the application that reads the ‘location’ field from the user context and returns responses based on the location. In such a scenario, when you are invoking any of the search APIs (live search, full search, or advanced search), you can send this field as part of userContext in the customData parameter as shown below. 

"customData": {
   "userContext": {
   "location": "Germany"
    }
},

Tips on using metaFilters and answerMetaFilters in the Search APIs

The parameter, metaFilters, can be used to define rules to filter out the search results. The rules can use any of the fields in the Search Index.  Similarly, answerMetaFilters can be used to filter chunks used to generate answers. The answerMetaFilters uses chunk fields used in the Answer Index

Both of these parameters expect an array of filters where each filter can have one or more rules. Here are some tips for defining metaFilters object.

  • You can define more than one filter using these parameters.
  • Each filter can have one or more rules to it. 
  • You can have more than one simple rule with logical operators AND or OR to form complex rules for a filter. 

To learn more about the chunk fields that can be used to add answerMetaFilters, go to the Chunk Browser and see the JSON view. Similarly, use Workbench Simulator to view the fields that can be used to define metaFilters

Advanced Search API

This API fetches search results and answers generated corresponding to the input query and the filters sent in the request body. This API returns results from all the data ingested into the SearchAssist application. You can sort the results, limit the number of search results, send additional search settings or request for qualified chunks for the generated answer using appropriate options in the request payload.  

Method POST
Endpoint <host_url>/searchassistapi/external/stream/<streamId>/advancedSearch
Content-Type application/json
Authorization auth: <JWT Token>
API Scope Advanced Search

Query Parameters

Parameters Description Mandatory
Stream ID Provide your application ID here. 
skip This is the number of index records to skip while fetching the records.  No. When not provided, the default value of 0 is used. 
limit This is the number of index records to be fetched in each API call.  No. When not provided, the default value of 50 is used.

Request Parameters

Parameters Description Mandatory
query Query string for search Yes
queryType This parameter can take one of the following two values:

  • relevanceWithMetaFilter – when queryType is set to this value, SearchAssist processes the results as per the metaFilters in the request object.
  • Relevance – If queryType is set to relevance, the metaFilters are ignored.
No
metaFilters This parameter can be used to define rules to filter out the search results. This parameter takes an array of rules with conditions. For example, in the following sample, we are adding a filter which has two rules that help you choose either the products . 

 "metaFilters": [
   {
       "condition": "OR",
       "rules": [
         {
               "fieldName": "productType",
               "fieldValue": [
                                  "washing machines"
                 ],
               "operator": "contains"
          },
          {
            "fieldName": "price",
             "fieldValue": [
              {
                     "lte": "15"
              }
              ],
              "operator": "range"
             }
           ]
   },
]
No 
answerMetaFilters This parameter can be used to define rules to filter out the results from the Answer Index before using them for generating the answer. This parameter takes an array of rules with conditions. For example, in the following example, we are selecting chunks only where the source is ‘web’. 

 “answerMetaFilters”:
 [ {
  “condition”: “AND”,
  “rules”: [
    {
      “fieldName”: “sourceType”,
      “fieldValue”: [
        “web”
      ],
      “operator”: “contains”
    }
  ]
}]
No
sort This parameter can be used to sort the results as per the index fields. For example, to sort the results in ascending order of the title, set this to: 

"sort": [
{
"fieldName": "title",
"order": "asc"
}]
No 
lang The language used for the query. No. By default, this is set to English.
customData Custom data to be sent in the request. This data can be used to further process or filter the search results in the application.  For example, you can use this field to set user context like user identity, location, etc. No
SearchSettings Search settings to be applied to the fields. The default search configuration of the application is overridden when this parameter is present in the request body. No
maxNumOfResults Max number of search results to be returned in the response.  Yes
facets This parameter can be used to facets to refine the search results. Refer to the sample payload below for an example.  No 
answerSearch This can be set to true or false. When set to ‘true’, the response will include answers. Conversely, when set to ‘false’, the response will omit the answer to the query. However, you can still use the includeChunksinResponse field to see the qualified chunks in the response. By default, it is set to true.  No
includeChunksInResponse This can be set to true or false. When set to true and if answers snippets are enabled, the response will also have the list of qualified chunks along with other parameters. The chunk information is stored in chunk_result

field in the response. 

No

Sample Request payload 

{
  "query": "show me shirts less than $20",
  "maxNumOfResults": 20,
  "queryType": "relevanceWithMetaFilter",
  "customData": {
    "userContext": {
      "userId": "u-cdd39325-b89e-517b-b3d6-18b75a5f09a6"
    }
  },
  "sort": [
    {
      "fieldName": "title",
      "order": "asc"
    }
  ],
  "metaFilters": [
    {
      "condition": "OR",
      "rules": [
        {
          "fieldName": "productType",
          "fieldValue": [
            "jackets"
          ],
          "operator": "contains"
        },
        {
          "fieldName": "price",
          "fieldValue": [
            {
              "lte": "1500"
            }
          ],
          "operator": "range"
        }
      ]
    },
    {
      "condition": "AND",
      "rules": [
        {
          "fieldName": "productType",
          "fieldValue": [
            "shirts"
          ],
          "operator": "contains"
        },
        {
          "fieldName": "price",
          "fieldValue": [
            {
              "lte": 1500
            }
          ],
          "operator": "range"
        }
      ]
    }
  ],
  "facets": [
    {
      "name": "MensWear",
      "subtype": "value",
      "size": 10,
      "sortConfig": {
        "sortBy": "count",
        "order": "desc"
      },
      "fieldName": "productType"
    }
  ]
}

Response Format

Search Results are listed as results field in the response. Search results from different sources are separated by source name in the results field. If answerSearch is set to true, the answer for the given query is presented in the graph_answer field. If includeChunksInResponse is set to true, the chunk details are available in the chunk_result field. 

The format of the API response is as shown below. Note that the response format can vary depending on the request payload.


Tips on using customData parameter in the Search APIs

The parameter, customData, in the request object can be used to send custom data to the SearchAssist application. This field can be used to set the userContext when performing the search through APIs. For example, if your search results depend on the location of the user and you have a business rule in the application that reads the ‘location’ field from the user context and returns responses based on the location. In such a scenario, when you are invoking any of the search APIs (live search, full search, or advanced search), you can send this field as part of userContext in the customData parameter as shown below. 

"customData": {
   "userContext": {
   "location": "Germany"
    }
},

Tips on using metaFilters and answerMetaFilters in the Search APIs

The parameter, metaFilters, can be used to define rules to filter out the search results. The rules can use any of the fields in the Search Index.  Similarly, answerMetaFilters can be used to filter chunks used to generate answers. The answerMetaFilters uses chunk fields used in the Answer Index

Both of these parameters expect an array of filters where each filter can have one or more rules. Here are some tips for defining metaFilters object.

  • You can define more than one filter using these parameters.
  • Each filter can have one or more rules to it. 
  • You can have more than one simple rule with logical operators AND or OR to form complex rules for a filter. 

To learn more about the chunk fields that can be used to add answerMetaFilters, go to the Chunk Browser and see the JSON view. Similarly, use Workbench Simulator to view the fields that can be used to define metaFilters