Skip to main content

getUsersByVectorSearch

Searches users by meaning (semantic vector search). 🔐 This method requires authorization.

Description​

Searches users by the meaning of a natural-language query rather than by exact keywords. Resolves to an IVectorSearchResponse<IUsersResponse>: the users are in items, the count in total. indexReady: false means the search index for users in this language isn't built yet, so empty items don't mean that nothing matched.

.getUsersByVectorSearch(

, , ,

);

Parameters schema​

Schema

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

{ queryText: "john" }

body.queryText(required): string
Natural-language search query.
example: "john"

body.vectorDistanceThreshold: number
Override of the cosine distance threshold (0..2).
example: 0.3

body.maxHits: number
Number of top candidates fetched before pagination. 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. Default: 0. offset + limit must not exceed 200; a larger window is rejected with 400.
example: 0

limit: number
Maximum number of records to return. Default: 30.
example: 30

Examples​

Minimal example​

const response = await Users.getUsersByVectorSearch({ queryText: 'john' });

Example with all parameters​

const response = await Users.getUsersByVectorSearch(
{
queryText: 'john',
vectorDistanceThreshold: 0.3,
maxHits: 50,
},
'en_US',
0,
30,
);

Example response​

{
"items": [],
"total": 0,
"indexReady": false
}

Response schema​

Schema: IVectorSearchResponse<IUsersResponse>

items: IUserEntity[]
Users that match the query.

items.id: number
Object ID.
example: 12345

items.identifier: string
The user's login: an email, phone number or username, depending on the auth provider.
example: "user_12345"

items.authProviderIdentifier: string
Marker of the authentication provider.
example: "auth_provider_12345"

items.formData: FormDataType[]
Form fields with their values.
example:

[
{
"marker": "last_name",
"type": "string",
"value": "Username"
}
]

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

items.groups: Array<string | number>
IDs of the user groups the user belongs to (numbers on the API).
example: [1]

items.state: object
Custom key-value data stored with the user.
example:

{
"orderCount": 1
}

items.moduleFormConfigs: Array<IFormConfig>
Form configurations of the module associated with the user.

items.rating: IRating
Rating data: average value, likes and dislikes, and the calculation method.

items.distance: number
Cosine distance to the query (lower is closer). Present only on items returned by getUsersByVectorSearch().
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.

Keyword search with globalSearch() covers only products, pages, blocks and discounts, not users.