liveBook · Manning

Hybrid search

As explained in Natural Language Processing in Action, Second Edition

A hybrid search pipeline combines vector-similarity retrieval with full-text retrieval to search by both semantic and lexical signals.

Hybrid search combines lexical retrieval, which matches words and term-frequency signals, with semantic retrieval, which matches meaning through embeddings. The combination helps search systems find both exact terminology and relevant paraphrases. section 1.1.1

A hybrid search pipeline brings together:

  • Full-text indexes for occurrence-based or keyword retrieval. section 1.1.1
  • Vector indexes for semantic similarity over embedding representations. section 1.1.1
  • A shared production database, such as PostgreSQL with pgvector, which supports exact and approximate similarity indexes alongside full-text search. section 10.3.5

Scaling a production search pipeline

Store document embeddings in PostgreSQL with pgvector and use its full-text indexes at the same time. This design can scale an NLP pipeline to millions of users and documents, while dimensionality limits may require PCA before storage. section 10.3.5

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Builds from term-frequency retrieval and full-text search toward embeddings and a scalable hybrid pipeline.
Examples
Uses keyword search, embedding-based semantic search, PostgreSQL, and pgvector as concrete implementation examples.
What you can do after
Operate/configure PostgreSQL with pgvector and full-text indexes for scalable hybrid retrieval.
How it connects
Connects embeddings, full-text search, vector databases, PostgreSQL, approximate nearest-neighbor search, and dimensionality reduction.

Also explained in

Compare how 8 books explain hybrid search →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.