For text data with vectorization defined, you can use the semantic text search feature to search for semantically similar text. The pgx_vectorizer.pgx_similarity_search function is used for the semantic text search.
The values in the distance column represent the distance between the text specified as an argument and the chunk, and the smaller the distance value, the higher the similarity to the text.
Example) Semantic text search
SELECT * FROM pgx_vectorizer.pgx_similarity_search('sample_embeddings'::regclass, 'text for search', 5, '<=>'); embedding_uuid | chunk | distance ----------------------------------------------+--------------------------+-------------- 89A-927B-4271-82A3-6A73E8962B1C | Action items assigned. | 0.1027381927364 8E73B5F2-461A-4622-89A9-C1D364F4E19B | Next steps discussed. | 0.2938471928374 5D39A6E1-B226-4197-9F03-A78B80A509C2 | Timeline adjusted. | 0.5183749128735 2F97C1E5-6E8A-400F-8692-177D77740B6A | Budget approved. | 0.7815239187521 A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11 | Status update. | 0.9274618273645 (5 rows)
Information
The pgx_vectorizer.pgx_similarity_search function specifies the type of distance to be used in vector similarity searches performed for semantic searches. If this specification differs from the distance specified when defining an index for vector data, the index will not be used during the search.