This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Create a searchable knowledge base that finds content by meaning, not
just keywords.
Problem
You have a collection of text content (articles, notes, documentation)
and need to find relevant items based on meaning.
Keyword search fails when users phrase queries differently from the
source text:
Solution
What’s in this recipe:
- Create a text table with embeddings
- Search by semantic similarity
- Combine with metadata filters
You add an embedding index to your text column. Pixeltable automatically
generates embeddings for each row and enables similarity search.
Setup
Create knowledge base
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/pjlb/.pixeltable/pgdata
Created directory ‘search_demo’.
<pixeltable.catalog.dir.Dir at 0x14208ca10>
Created table ‘articles’.
Inserting rows into `articles`: 4 rows [00:00, 577.69 rows/s]
Inserted 4 rows with 0 errors.
4 rows inserted, 12 values computed.
Add semantic search
Create an embedding index on the content column:
Search by meaning
Find content semantically similar to your query:
Combine semantic search with metadata filters:
Explanation
How similarity search works:
- Your query is converted to an embedding vector
- Pixeltable finds the most similar vectors in the index
- Results are ranked by cosine similarity (0 to 1)
Embedding models:
New content is indexed automatically:
When you insert new rows, embeddings are generated without extra code.
See also