Skip to main content

SQL Search REST Interface

This topic describes the REST interface for InterSystems SQL Search.

REST Syntax for SQL Search

SQL Search provides the REST API to access SQL Search indexed results.

The endpoint syntax is "/table/:TableName/search" where TableName is a table which contains at least one SQL Search index.

A sample access path would be like http://localhost:443/api/iKnow/v1/user/table/iFind.Table/search.

You need to use "POST" to access the endpoint. You can put the search parameters as a JSON object in the body of the request.

Search Parameters

The following are the supported parameters:

{      "query":"string",
   "index":"string",
   "option": 0,
   "distance": "string",
   "language":"string",
   "includeText": 0,
   "columns": ["string"],
   "highlightSpec": {
      "tag": "<b>",
      "limit": 0,
      "name": "Highlighted"
      },
   "rankSpec": {
      "name": "Rank"
     }
 } 

"query" specifies the SQL Search query.

"index" specifies which SQL Search index you would like to search. If you do not specify an index, SQL Search uses the first index found.

"option" is an integer that specifies the type of search to perform. Available values include 0 (syntax search), 1 (syntax search with stemming), 2 (syntax search with decompounding and stemming), 3 (syntax search with fuzzy search), and 4 (syntax search with Regular Expressions).

"language" specifies a two-character string that specifies the language of the text. For example, "en" specifies English.

"includeText" and "columns" specify which columns you would like to return. When "includeText" is specified as 1, the field indexed by the SQL Search index is returned. You can use "columns" to specify other column names as a JSON array of strings.

"highlightSpec {name}" specifies the column alias name for the highlight column.

"rankSpec {name}" specifies the column alias name for the rank column.

The returned results format is a JSON object. The returned rows are formatted in a "rows" JSON array: { "rows":[{},{},{}] }.

FeedbackOpens in a new tab