The post introduces a method for building an in-browser semantic search experience using PGlite, pgvector, and Transformers.js. This setup could benefit eCommerce sites by quickly surfacing relevant products without server roundtrips. It includes instructions for setting up the database schema and code examples for a React application, enabling local storage and retrieval of text and embeddings using IndexedDB.
Table of contents
Install the dependencies #Create the Database schema #Seed the Database with text and embeddings #Define the inner product search function with pgvector #Create an embedding for the search term #Perform the search #More Supabase Resources #1 Comment
Sort: