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:

  1. call the scenario search endpoint with scenario autocomplete-texts which will perform a query against the article index
  2. parse the items from the response to render the list of matched articles — each item contains the article title, advertisedUrl, and metadata
  3. (optional) use the highlight field to render parts of the title that matched the searched query (bold text, same as in the product autocomplete)
⚠️

The title field 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:

FieldDescription
idUnique article identifier.
titleArticle title. Displayed in the autocomplete widget. Must be filled in your text feed.
advertisedUrlURL of the article page. Use this to link the autocomplete result.
contentStringFull text content of the article.
tagsArray of tags associated with the article.
wordCountWord count of the article content.
⚠️

Do not add contentString to includeFields — 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 override includeFields if you need to inspect the full article content for testing or debugging, and never include contentString in 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
}