© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
4 replies
yairtheyair

Help: Any way do query via pgvector operators AND supabase client js in frontend?

just want a simple cosine similarity to query in frontend via supabase client.
I already have the embeddings for both

my current code:

const queryEmbedding = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0];
const similarityThreshold = 0.7;
const matchCount = 5;

const { data, error } = await supabase
        .from('docs')
        .select('*')
        .gte(
const queryEmbedding = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0];
const similarityThreshold = 0.7;
const matchCount = 5;

const { data, error } = await supabase
        .from('docs')
        .select('*')
        .gte(
1 - (embedding <=> ARRAY[${queryEmbedding.join(',')}]
, similarityThreshold)
        .order(
, similarityThreshold)
        .order(
embedding <=> ARRAY[${queryEmbedding.join(',')}]
, { ascending: false })
        .limit(matchCount);
, { ascending: false })
        .limit(matchCount);



PLEASE any advice will help really need this feature to work!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Any way to query Supabase from BQ?
SupabaseSSupabase / help-and-questions
4y ago
Supabase JS query question
SupabaseSSupabase / help-and-questions
13mo ago
Help with query via the client API
SupabaseSSupabase / help-and-questions
3y ago
Supabase/Pgvector -> Very Slow
SupabaseSSupabase / help-and-questions
7mo ago