Skip to main content

getFormsDataByVectorSearch

Search form data by meaning (semantic vector search).

Description​

Searches form data by meaning rather than exact keywords, using a natural-language query. Resolves to an IVectorSearchResponse<IFormsDataSearchResponse>: the records are in items, the count in total. No user authorization is required.

When indexReady is false, the search index for this entity and language isn't built yet, so empty items don't mean that nothing matched.

The records are IFormDataSearchEntity objects. Unlike the records from getFormsDataByMarker() with the default isExtended = 0, they carry the moderation and sender fields: status, isUserAdmin, userIdentifier, entityIdentifier, parentId and formModuleId. Every item also has a distance field (cosine distance to the query; lower is closer), whether or not you pass debug. Fields the record doesn't have are omitted.

.getFormsDataByVectorSearch(

, , ,

);

Parameters schema​

Schema

body(required): IFormsDataVectorSearch
Vector search parameters.
example:

{ queryText: "order confirmation" }

body.queryText(required): string
Natural-language search query, 1 to 512 characters: an empty one answers 400 queryText should not be empty, a longer one 400 queryText must be shorter than or equal to 512 characters.
example: "order confirmation"

body.vectorDistanceThreshold: number
Override of the cosine distance threshold (0..2); a negative value answers 400.
example: 0.3

body.maxHits: number
Number of top candidates fetched before pagination, from 1. Default: 100. Maximum: 500.
example: 10

body.debug: boolean
Deprecated and ignored: the API no longer reads debug and returns distance on every item.
example: false

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

offset: number
Number of records to skip, 0 or more. Default: 0.
example: 0

limit: number
Maximum number of records to return, 1 or more. Default: 30.
example: 30

Examples​

Minimal example​

const response = await FormData.getFormsDataByVectorSearch({ queryText: 'order confirmation' });

Example with optional parameters​

const response = await FormData.getFormsDataByVectorSearch(
{
queryText: 'order confirmation',
vectorDistanceThreshold: 0.3,
maxHits: 50,
},
'en_US',
0,
30,
);

Example response​

{
"items": [
{
"id": 9242,
"formIdentifier": "test-form",
"time": "2026-10-27T09:14:47.131Z",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
],
"userIdentifier": "john@example.com",
"entityIdentifier": "blog",
"parentId": null,
"isUserAdmin": false,
"status": "sent",
"formModuleId": 2,
"distance": 0.110015869140625
},
{
"id": 9239,
"formIdentifier": "test-form",
"time": "2026-10-26T16:25:38.689Z",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
],
"userIdentifier": "john@example.com",
"entityIdentifier": "blog",
"parentId": null,
"isUserAdmin": false,
"status": "sent",
"formModuleId": 2,
"distance": 0.110015869140625
},
{
"id": 9221,
"formIdentifier": "test-form",
"time": "2026-10-26T13:48:20.498Z",
"formData": [
{
"marker": "name",
"type": "string",
"value": "Test"
}
],
"userIdentifier": null,
"entityIdentifier": "blog",
"parentId": null,
"isUserAdmin": false,
"status": "sent",
"formModuleId": 2,
"distance": 0.110015869140625
}
],
"total": 100,
"indexReady": true
}

Response schema​

Schema: IVectorSearchResponse<IFormsDataSearchResponse>

items: IFormDataSearchEntity[]
Form data records that match the query.

items.id: number
ID of the form data record.
example: 12345

items.formIdentifier: string
Marker of the form.
example: "contact_form"

items.time: Date | string
Date and time the form data was last changed.
example: "2023-02-12 10:56"

items.formData: FormDataType[]
Submitted form fields.
example:

[
{
"marker": "name",
"type": "string",
"value": "Test"
}
]

items.userIdentifier: string | null
Text identifier of the user who submitted the form, or null for an anonymous submission.
example: null

items.entityIdentifier: string
Marker of the entity the record belongs to.
example: "blog"

items.parentId: number | null
Identifier of the parent form data record, or null for a top-level record.
example: null

items.ip: string
Not returned: the Content API removes this field from the response.
example: "127.0.0.1"

items.fingerprint: string
Not returned: the Content API removes this field from the response.
example: "UQ_123456_abcdef"

items.isUserAdmin: boolean
Whether the record was submitted by an admin.
example: false

items.status: FormDataStatus
Moderation status of the record.
example: "sent"

items.formModuleId: number
ID of the form module the record belongs to.
example: 2

items.distance: number
Cosine distance to the query; lower means closer. Always returned.
example: 0.12

total: number
Total number of found records.
example: 100

indexReady: boolean
false when no vectors are built yet for this entity and language: the query was not embedded, so empty items do not mean that nothing matched. true means the result comes from a real search.

Semantic search matches on meaning, not on the literal text. Keyword search with globalSearch() covers only products, pages, blocks and discounts.