Query API
The Query API is used to perform search functions on a data source.
For more information about:
-
Using the Springboard user interface, see Getting started with Springboard.
-
Adding and managing data sources, see Manage Springboard data sources.
-
HTTP response errors, see HTTP response errors.
Prerequisites
Before using this endpoint, use the Authentication API with the scope value of connectedsearch.query
to generate an access token. The access token is used to authenticate your requests.
You must also supply the APPLICATION_ID
value, as the request URL requires it. To obtain the value, click the Integrations icon from the Applications UI sidebar and then click the APIs tab. The value is in the Application ID field.
HTTP request guidelines
The following guidelines apply to the Query API endpoints:
-
The maximum HTTP request body size is 1 MiB.
-
If the request cannot be completed within 10 seconds, the server returns a 504 timeout error.
-
The API rate limit is 500 requests per minute per application.
Query API endpoints
Search
The results match all of the words in the query. You can also specify facets, filters, sort, and other fields to limit the results.
For example, enter the entire word "mysteries" to search the library catalog for records that include that word in the title, description, or other fields.
Information returned in the /search
endpoint can be used in other endpoints. For example, the id
of a result is used in the /detail
endpoint to retrieve more information about an individual record.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/search \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"query": "Star Wars",
"page": 0,
"limit": 1,
"utcOffset": "-05:00",
"sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
"sort": [
{"sortField": "relevancy", "sortOrder": "asc"}
],
"fieldList": ["document.title", "document.url"],
"facets": ["type", "file.extension", "document.languageCode"],
"highlight": false,
"filters": [
{"field": "document.languageCode", "values": ["en"]},
{"field": "datasourceLabels", "values": ["movies"]}
],
"analyticsData": true
}'
Searchahead
The results match partial terms that are entered in a single string of characters without spaces. As with the /search
endpoint, /searchahead
lets you specify filters, sort, and other fields. However, the /searchahead
endpoint does not combine with facets.
For example, results for every record that contains "nov" in the library catalog return many different genres specified as novels, or were published in November.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/searchahead \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"query": "star",
"page": 0,
"limit": 1,
"utcOffset": "-05:00",
"sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
"sort": [
{"sortField": "relevancy", "sortOrder": "asc"}
],
"fieldList": ["document.title", "document.url"],
"highlight": false,
"filters": [
{"field": "document.languageCode", "values": ["en"]},
{"field": "datasourceLabels", "values": ["movies"]}
],
"analyticsData": true
}'
Detail
Unlike the /search
and /searchahead
endpoints which use query terms to retrieve data, the /detail
endpoint retrieves the details about a particular record using its id
. You can specify more fields to display such as document.url
, document.author
, and document.languageCode
.
For example, id: "12345"
returns "The Purloined Letter" from the library catalog. Other fields you specified in the POST request are also displayed.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/detail \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"id": "441eb3be-7de6-470a-8141-e416a15c7db1-6a092bd4-5098-466c-94aa-40bf68294303-68708807657148371333355819934570439731",
"utcOffset": "-07:00",
"fieldList": ["document.title", "document.description", "document.body", "document.sourceCreateTimestamp", "document.sourceLastModifiedTimestamp", "document.author", "document.url", "document.languageCode", "document.thumbnailImage", "file.name", "file.extension"],
"sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa"
}'
Metatags
Metadata tags are descriptive text placed in the <head>
of a page’s source code. The metadata tag is not displayed on the page, but can be used by search engineers and others who need that information.
For example, the metadata tag information can be used with other endpoints.
For more information, see Web data source custom metadata tags.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/metatags \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
}'
Browse
This endpoint returns all of the results for the application. You can specify facets, filters, sort, and other fields to limit the results.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/browse \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"page": 0,
"limit": 2,
"utcOffset": "-05:00",
"sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
"sort": [
{"sortField": "relevancy", "sortOrder": "asc"}
],
"fieldList": ["document.title", "document.description"],
"facets": ["type", "file.extension", "document.languageCode"],
"filters": [
{"field": "document.languageCode", "values": ["en"]},
{"field": "datasourceLabels", "values": ["movies"]}
],
"analyticsData": true
}'
Related Content
This endpoint finds and returns documents that are semantically similar. The request requires either:
-
The
document.title
with the optional field ofdocument.description
, or -
The
id
obtained from the search result of the web page
You cannot use both the document.title and the id in the same request.
|
The following request using title
includes all possible fields. This includes an example custom metadata tag, page.metatags.rating
, which is requested as a value of the fieldList
parameter.
curl --request POST \
--url https://APPLICATION_ID.applications.lucidworks.com/query/relatedContent \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"probe": {
"title": "Lost Horizon",
"description": "Paradise"
},
"utcOffset": "-05:00",
"fieldList": [
"document.url", "document.title", "document.description", "document.sourceLastModifiedTimestamp", "page.metatags.rating"
],
"sessionId": "864782f0-af36-4dee-8430-9e73d6006eaa",
"limit": 5,
"source": "https://example.com/docs/movies",
"analyticsData": true
}'
For more information and examples, see Related Content.