wshobson avatar

Hybrid Search Implementation

Combines vector similarity search with keyword matching using reciprocal rank fusion and linear score combination. Includes PostgreSQL implementations with pgvector for when you need both semantic understanding and exact term matching in RAG systems. The templates handle score normalization, metadata filtering, and cross-encoder reranking. Most useful when pure vector search misses specific names or technical terms that users search for literally. The RRF approach works well out of the box, while the weighted linear combination gives you more control when you know your data patterns.

skills.sh installs
11.2K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill hybrid-search-implementation --agent claude-code

Installs into .claude/skills of the current project.

Files

Hybrid Search Implementation

Patterns for combining vector similarity and keyword-based search.

When to Use This Skill

  • Building RAG systems with improved recall
  • Combining semantic understanding with exact matching
  • Handling queries with specific terms (names, codes)
  • Improving search for domain-specific vocabulary
  • When pure vector search misses keyword matches

Core Concepts

1. Hybrid Search Architecture

Query → ┬─► Vector Search ──► Candidates ─┐
        │                                  │
        └─► Keyword Search ─► Candidates ─┴─► Fusion ─► Results

2. Fusion Methods

MethodDescriptionBest For
RRFReciprocal Rank FusionGeneral purpose
LinearWeighted sum of scoresTunable balance
Cross-encoderRerank with neural modelHighest quality
CascadeFilter then rerankEfficiency

Templates and detailed worked examples

Sponsors

Details

Repository
github.com/wshobson/agents
Categories
AI & Agent Building, Marketing & SEO

More from wshobson/agents

All 174
1getcargohq avatarcargo-contentgetcargohq/cargo-skillsManage workspace knowledge files and libraries in the Cargo content domain — upload, list, rename, move, and remove files (PDFs, CSVs, text), and create or sync11Kskills.sh installs
2aws avataraws-serverlessaws/agent-toolkit-for-awsBuilds, deploys, manages, debugs, configures, and optimizes serverless applications on AWS using Lambda, API Gateway, Step Functions, EventBridge, and SAM/CDK. 10.9Kskills.sh installs
3github avatarcreate-github-action-workflow-specificationgithub/awesome-copilotCreate a formal specification for an existing GitHub Actions CI/CD workflow, optimized for AI consumption and workflow maintenance.10.8Kskills.sh installs
4aws avataraws-observabilityaws/agent-toolkit-for-awsBuilds, configures, debugs, and optimizes AWS observability with CloudWatch (Log Insights, Metrics, Alarms, Dashboards, EMF), X-Ray, CloudTrail, and ADOT (AWS D10.7Kskills.sh installs
5wshobson avatarparallel-feature-developmentwshobson/agentsCoordinate parallel feature development with file ownership strategies, conflict avoidance rules, and integration patterns for multi-agent implementation. Use t10.3Kskills.sh installs
6wshobson avatartask-coordination-strategieswshobson/agentsDecompose complex tasks, design dependency graphs, and coordinate multi-agent work with proper task descriptions and workload balancing. Use this skill when bre10.2Kskills.sh installs