liveBook · Manning

Lexical search

As explained in AI Agents in Action, Second Edition

Keyword matching retrieves content by comparing literal terms in a query with terms in stored content.

Lexical search retrieves content by matching literal query terms against terms in stored content. Unlike semantic search, it does not match different words merely because they have similar meanings. section 6.1.1

In retrieval-augmented generation (RAG), keyword search can work alongside vector search to find relevant information for an agent. A hybrid setup combines both tools and can inspect their calls before producing a grounded answer. section 6.5

A hybrid search query

For “At what exact time does the lightning strike the clock tower?”, a hybrid RAG agent uses keyword and vector search tools, then returns a grounded answer. section 6.5

How AI Agents in Action, Second Edition covers it

How deep it goes
Defines lexical matching by contrasting it with semantic similarity, without detailing its implementation.
Examples
Uses an exact-time question about a lightning strike to demonstrate hybrid keyword and vector retrieval.
What you can do after
Apply keyword search alongside vector search in a hybrid RAG agent and inspect the retrieval calls.
How it connects
Connects keyword search with semantic search, vector search, and retrieval-augmented generation.

Also explained in

Compare how 8 books explain lexical search →

Related concepts

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