Top
Enterprise Postgres 18 Knowledge DataManagement FeatureUser's Guide

3.12.3 Calculation of Search Accuracy Using External Tools

When calculating the search accuracy of subqueries using external tools, the search results of each subquery are obtained from trace information.

To retrieve the search results of a subquery, execute the pgx_list_search_results function by specifying the query ID and the type of subquery. When executed, a set of text chunks is returned in descending order of score, in the same format as the hybrid search results.

Example) Retrieve the search results of the full-text search subquery with query ID 10001

rag_database=> SELECT pgx_vectorizer.pgx_list_search_results(queryid => 10001, subquery_type => 'fulltext');

As a result, by providing the search results of subqueries for evaluation queries and the correct answers corresponding to evaluation queries to the evaluation tool, the search accuracy of subqueries can be calculated.