Error searching for documents: PGRST202 Could not find the function public.match_documents(filter, match_count, query_embedding) in the schema cache Searched for the function public.match_documents with parameters filter, match_count, query_embedding or with a single unnamed json/jsonb parameter, but no matches were found in the schema cache.
drop function if exists match_documents(vector, float, int);
create or replace function match_documents (
query_embedding vector(1536),
match_count int default null,
filter jsonb default '{}'
) returns table (
id bigint,
content text,
metadata jsonb,
similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
return query
select
id,
content,
metadata,
1 - (knowledge_chunks.embedding <=> query_embedding) as similarity
from knowledge_chunks
where metadata @> filter
order by knowledge_chunks.embedding <=> query_embedding
limit match_count;
end;
$$;
notify pgrst, 'reload schema';
select n.nspname as schema, p.proname, pg_get_function_identity_arguments(p.oid) as arguments
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where p.proname = 'match_documents';