# Rerank knowledge search on any vector database

> Agno's Knowledge now takes a reranker that runs on every vector database. It fetches a wider pool of candidates, reorders them and returns the top results, so one reranker works across backends.

- Published: 2026-09-23
- Author: Sannya Singal
- Categories: Changelog
- Canonical: https://www.agno.com/articles/rerank-knowledge-search-on-any-vector-database
- Markdown: https://www.agno.com/articles/rerank-knowledge-search-on-any-vector-database.md

Agno's `Knowledge.search()` now runs the reranker itself, in its own retrieval pipeline. It used to return whatever the vector database returned, so anything that reordered results had to be built into each adapter, and only some adapters had it.

<Video
  src="/videos/changelog-knowledge-rerankers-terminal.mp4"
  controls
  preload="metadata"
  aria-label="A terminal recording of one help-center search ranked by plain vector search and by MMRReranker, which swaps duplicate password articles for SSO and two-factor recovery"
/>

Pass a reranker to `Knowledge` and every search goes through it:

```python
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reranker import MMRReranker

knowledge = Knowledge(
    vector_db=vector_db,
    reranker=MMRReranker(candidate_multiplier=5, max_candidates=100),
)

results = knowledge.search("How do I rotate an API key?", max_results=5)
```

![The four steps of knowledge.search with max_results=5 and a reranker. First, Agno widens the fetch and asks the vector db for 5 times candidate_multiplier results, capped at max_candidates. Second, any vector db such as PgVector, Qdrant or Elasticsearch returns the candidates. Third, the reranker on Knowledge, such as MMRReranker, RecencyReranker, CohereReranker or your own, reorders the whole pool. Fourth, Knowledge returns the top 5.](https://www.agno.com/images/v3-0-11-knowledge-retrieval-pipeline.png)

A reranker can only surface a document that the search retrieved in the first place. So the pipeline asks the vector database for more candidates than you requested: `max_results` times the reranker's `candidate_multiplier`, capped at `max_candidates` (100 by default). The reranker reorders that whole pool, and `Knowledge` returns the top `max_results`.

The pipeline ships with two new rerankers, [`MMRReranker`](https://www.agno.com/articles/get-diverse-search-results-with-the-mmr-reranker) for diverse results and [`RecencyReranker`](https://www.agno.com/articles/rank-newer-documents-higher-with-the-recency-reranker) for fresh ones. Existing rerankers such as `CohereReranker` work on it too. `Reranker.arerank` now runs a synchronous reranker in a worker thread, so a reranker that calls a provider no longer blocks your event loop.

### The vector database reranker is deprecated

Setting `reranker` on a vector database still works and now logs a deprecation warning. Move it to `Knowledge(reranker=...)`, which applies to every vector database and supports async. If you set a reranker in both places, Agno applies the one on `Knowledge` and ignores the vector database's.

We also fixed several vector databases so rerankers get what they need. Cassandra, Chroma, Couchbase, Elasticsearch, OpenSearch, Pinecone and Upstash now attach their embedder to search results. Qdrant named-vector searches return a usable embedding, and `PineconeDb` takes `return_vectors=True` to include vectors in results.

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/07_knowledge/02_building_blocks/07_knowledge_level_reranking.py), and learn more about [reranking](https://docs.agno.com/knowledge/concepts/search-and-retrieval/reranking) and [search and retrieval](https://docs.agno.com/knowledge/concepts/search-and-retrieval/overview) in the documentation.
