autocomplete-texts
Article search for the autocomplete widget — querying and rendering article results.
The autocomplete-texts scenario searches across articles (e.g. blog posts, help pages, shipping info) and returns matching results for use in the autocomplete widget. Typically, article results are displayed alongside product results within the same autocomplete window — to fully render it, make two parallel calls: autocomplete for products and autocomplete-texts for articles.
In order to render article suggestions using the API integration, one must:
- call the scenario search endpoint with scenario
autocomplete-textswhich will perform a query against the article index - parse the
itemsfrom the response to render the list of matched articles — each item contains the articletitle,advertisedUrl, and metadata - (optional) use the
highlightfield to render parts of the title that matched the searched query (bold text, same as in the product autocomplete)
The
titlefield must be filled in your text feed. If it is missing, the article will appear as an empty result in the autocomplete widget.
This scenario is for autocomplete only — facet counts and filtering are not supported.
Article fields
Each article in the index contains the following fields:
| Field | Description |
|---|---|
id | Unique article identifier. |
title | Article title. Displayed in the autocomplete widget. Must be filled in your text feed. |
advertisedUrl | URL of the article page. Use this to link the autocomplete result. |
contentString | Full text content of the article. |
tags | Array of tags associated with the article. |
wordCount | Word count of the article content. |
Do not add
contentStringtoincludeFields— it contains the full article text and will significantly increase response size. The default fields returned by the API are sufficient for rendering autocomplete results. Only overrideincludeFieldsif you need to inspect the full article content for testing or debugging, and never includecontentStringin production autocomplete responses.
Example call
Call to the autocomplete-texts scenario:
curl -X POST --location "https://api.develop.perselio.com/api/v3/search/scenarios/autocomplete-texts/query" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Zoe-Token YOUR-TOKEN" \
-d '{
"searchQuery": "doprava",
"page": 0,
"pageSize": 5,
"zoeId": "anonymous-user-id"
}'JSON response (truncated):
{
"items": [
{
"item": {
"advertisedUrl": "https://www.example.com/doprava-a-platba/",
"id": "f41427a07519469f1.34718981",
"tags": [],
"title": "Doprava a platba",
"wordCount": 1834
},
"highlight": {
"title": {
"matchedTokens": [
"doprava"
],
"snippet": "<mark>Doprava</mark> a platba",
"value": null
}
}
}
],
"facetCounts": [],
"page": 0,
"pageSize": 5,
"totalItems": 3,
"totalPages": 1
}Updated 11 days ago
