Top
Enterprise Postgres 17 SP1 Knowledge DataManagement FeatureUser's Guide

3.11.5 Semantic Search Functions

It provides the following functions for semantic text search.

Function

Return type

Description

pgx_similarity_search(view pg_catalog.regclass, query text, num_result integer defaut 5, distance_operator text default '<=>', OUT embedding_uuid uuid, OUT chunk text, OUT distance float8);

SETOF record

Searches the embedding view specified in view to obtain text similar to the text specified in query.

You can display results up to the number specified in num_result.

You can specify the distance calculation method using distance_operator.

pgx_similarity_search_checking_index(view pg_catalog.regclass, query text, num_result integer defaut 5, distance_operator text default '<=>', OUT embedding_uuid uuid, OUT chunk text, OUT distance float8);

SETOF record

An error occurs if the index operator defined in the embedding column of the table that references the view does not match the operator specified in distance_operator.

Other than the above, it is the same as the pgx_similarity_search function.