similarity-search-patterns

Implement hybrid similarity search with vector databases and metadata filtering.

Updated May 3, 2026
One-click install
npx skills add https://github.com/miethe/boxbrain-2 --skill similarity-search-patterns-miethe
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: similarity-search-patterns
Source: https://github.com/miethe/boxbrain-2/tree/main/.claude/skills/similarity-search-patterns
Command: npx skills add https://github.com/miethe/boxbrain-2 --skill similarity-search-patterns-miethe

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineers design and implement efficient semantic and hybrid similarity search without sacrificing retrieval quality, latency, scalability, or explainability.

Core Features & Use Cases

  • Vector Database Patterns: Provides implementation templates for Pinecone, Qdrant, pgvector, and Weaviate.
  • Search Optimization: Covers distance metrics, HNSW and IVF indexing, filtering, reranking, quantization, and latency-aware tuning.
  • Hybrid Retrieval: Combines dense vector search with keyword or BM25-style search for stronger results across RAG, recommendations, and enterprise content discovery.
  • Use Case: Apply the Skill when building a production search service that must retrieve relevant documents, apply metadata restrictions, and rerank candidates for improved relevance.

Quick Start

Use the similarity search patterns skill to design a hybrid pgvector retrieval system with metadata filtering, HNSW indexing, and reranking for an enterprise document catalog.

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 hybrid retrieval combining semantic vector search with keyword filtering?

Hybrid retrieval combines dense vector search with BM25-style keyword search to improve relevance. You apply this pattern by merging results from both methods, enabling stronger outcomes for RAG pipelines and enterprise content discovery.

What is the best way to optimize pgvector similarity search latency for large-scale workloads?

Optimize pgvector similarity search by configuring HNSW and IVF indexing, applying quantization, and tuning distance metrics. These patterns reduce latency and improve scalable storage for large-scale nearest-neighbor workloads in PostgreSQL.

How does HNSW indexing improve vector database retrieval performance?

HNSW indexing improves vector database retrieval by building hierarchical graph structures for fast approximate nearest-neighbor search. It accelerates query latency while maintaining high recall for semantic search workloads.

When should I use reranking in a semantic search pipeline?

Use reranking in semantic search pipelines when initial candidate retrieval yields mixed relevance. Applying a reranking step refines the top candidates, satisfying production requirements for improved precision in RAG and recommendation contexts.

Can I use these similarity search patterns with Pinecone, Qdrant, and Weaviate?

Yes, these similarity search patterns provide implementation templates for Pinecone, Qdrant, pgvector, and Weaviate. They cover indexing, metadata filtering, and scalable storage across these vector databases for production search services.

Why does my vector search return irrelevant documents despite using dense embeddings?

Vector search returns irrelevant documents when relying solely on dense embeddings without metadata filtering or hybrid retrieval. Combining dense search with BM25 keyword methods and reranking improves relevance and recall evaluation.