similarity-search-patterns

Implement vector similarity search with Pinecone, Qdrant, pgvector, and Weaviate.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill similarity-search-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: similarity-search-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/similarity-search-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill similarity-search-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pinecone, qdrant-client, asyncpg, weaviate, sentence-transformers, numpy.

What problem does it solve? Building semantic search, RAG retrieval, or recommendation systems requires choosing distance metrics, index types, and vector database implementations, which is error-prone without proven patterns. ## Core Features & Use Cases - Ready-to-use vector store templates: Complete Python implementations for Pinecone, Qdrant, pgvector (PostgreSQL), and Weaviate covering upsert, search, filtering, and deletion. - Hybrid search patterns: Combine dense vector search with keyword/BM25 retrieval and cross-encoder reranking for better relevance. - Index and metric guidance: Compare Flat, HNSW, and IVF+PQ indexes plus cosine, Euclidean, dot product, and Manhattan distance metrics. - Use Case: When building a RAG pipeline, use the pgvector template to store document embeddings in PostgreSQL and run hybrid vector plus full-text search with a single SQL query. ## Quick Start Ask the AI to implement a similarity search store using the Qdrant template with cosine distance and metadata filtering for your document collection.

Frequently Asked Questions about similarity-search-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement vector similarity search in Python?

Use a vector database client like Pinecone, Qdrant, pgvector, or Weaviate to upsert embedding vectors and query by nearest neighbors. The templates provide complete classes handling index creation, batch upserts, filtered search, and reranking.

Pinecone vs Qdrant vs pgvector: which vector database should I use?

Pinecone is a managed serverless option, Qdrant offers self-hosted search with quantization and rich filtering, and pgvector adds vector search to existing PostgreSQL databases. Choose based on scale, infrastructure, and whether you already run Postgres.

What is the difference between HNSW, Flat, and IVF+PQ indexes?

Flat indexes give exact results with O(n) search for small datasets, HNSW graph indexes reach 95-99% recall with O(log n) search for medium to large data, and IVF+PQ quantization suits very large datasets with 90-95% recall.

How do I combine vector search with keyword search?

Use hybrid search: pgvector template combines vector similarity with PostgreSQL full-text search via ts_rank, while Weaviate offers a built-in hybrid mode with an alpha parameter blending BM25 and vector scores.

Does pgvector support metadata filtering during search?

Yes, the pgvector template filters on JSONB metadata fields using SQL WHERE clauses combined with vector distance ordering. This lets you pre-filter documents by metadata before ranking by embedding similarity.

When should I not use approximate nearest neighbor indexes?

Avoid ANN indexes like HNSW when your dataset is small enough for exact flat search or when you need guaranteed 100% recall. Start with a flat index and scale up only after measuring recall and latency requirements.