Skip to content

How hybrid search ranks

Hybrid search ranks the stored pages two times, and it fuses the two lists into one list:

  1. The words. The full-text index (SQLite FTS5) ranks the pages by BM25. These pages are the candidates, 50 by default.
  2. The meaning. A local model changes the question and each page into vectors. The vector store ranks the pages by the cosine of the vectors. The fusion takes the 50 nearest pages, by default.
  3. The fusion. Reciprocal rank fusion gives each page the sum of 1 / (k + rank) over the lists that hold it. The constant k is 60 by default.

Select a question. Then move k and the two counts, and look at the lines. A blue line is a rank of the full text, and an orange line is a rank of the vectors. Select a page to see its fused score.

The questionpizza after midnight

1Pizza stone care0.03202Filter FX-22070.03083Forno Esempio0.01644Late checkout0.01615Crust and crumb0.01596Panificio rye loaf0.01547Olio Esempio0.01528Bread flours0.01499Filter guide0.014510Filter FX-22700.014311Museum hours0.014112City archive0.013913Monday market0.013714Museum visit0.0135

Forno Esempiothe page that answers

Full text: not in the list. No word of the question is on the page.

Vectors: rank 1, cosine similarity 0.656.

Fused: rank 3 of 14.

The fused score: 1 / (60 + 1) = 0.0164

No word of the question is on the page of Forno Esempio, so the full text misses it. The word “after” even gives a water filter. The vectors rank Forno Esempio first.
  • A rank of the full text that counts
  • A rank of the vectors that counts
  • The page that answers the question
The rankings as a table
FusedPageFull textVectorsScore
1Pizza stone care140.0320
2Filter FX-2207280.0308
3Forno Esempionone10.0164
4Late checkoutnone20.0161
5Crust and crumbnone30.0159
6Panificio rye loafnone50.0154
7Olio Esempionone60.0152
8Bread floursnone70.0149
9Filter guidenone90.0145
10Filter FX-2270none100.0143
11Museum hoursnone110.0141
12City archivenone120.0139
13Monday marketnone130.0137
14Museum visitnone140.0135

The full-text ranks come from the index of polite-crawler 0.1.3. The vector ranks come from Xenova/bge-small-en-v1.5 through transformers.js 4.3.1, in a CI run on 2026-10-18.

The fourteen pages are made up, on .example hosts. The numbers are not made up:

  • The full-text ranks come from the real index of polite-crawler. A test of the site builds the index again and compares the ranks.
  • The vector ranks come from a run of the real model, Xenova/bge-small-en-v1.5 through transformers.js, in CI. The workflow search-figure.yml writes the data with the model, the versions, the date and the commit.
  • The fusion is fuseRanks from polite-crawler, compiled into this page. A test makes sure that it gives the same list as the real find with rank: "hybrid".

Each list finds pages that the other list misses:

  • The words find the exact text. A barcode, a product code, a name or a rare word has little meaning for a model. BM25 finds the exact text. Select “8001234567896” in the figure.
  • The vectors find the meaning. A question can use different words than the page, for example “pizza” for a page about “pies”. BM25 then misses the page, and the model finds it. Select “pizza after midnight”.
  • The vectors always give a ranking. A list of vectors has each page, also when no page matches well. Thus a page with a low similarity still gets a rank. The full text gives nothing when no word matches.

Each list gives a page 1 / (k + rank). The constant k sets how much the top of a list counts:

k Rank 1 Rank 2 Rank 10 The effect
0 1.000 0.500 0.100 The first place of one list decides.
60 0.0164 0.0161 0.0143 A page in the two lists wins over a page in one list.

The value 60 comes from the paper that described reciprocal rank fusion (Cormack, Clarke and Büttcher, SIGIR 2009). Select “wheelchair access”, and move k from 60 to 0. The page with the ramp goes from the fourth place to the second place.

The fusion takes only the first candidates pages of the full text and the first neighbors pages of the vectors. A page after the cut gets nothing from that list. The counts keep the work small in a large store:

  • Each candidate of the full text that has no vectors gets them before the fusion. Thus candidates limits the work of the embedder in a search.
  • The vector search compares the question with each stored chunk. neighbors limits the pages that it gives to the fusion.

Hybrid search is opt-in. It needs an embedder, and embed gives vectors to the stored pages:

import { openCrawler, transformersEmbedder } from "polite-crawler";
const crawler = openCrawler({ dir: "./crawl", embedder: transformersEmbedder() });
await crawler.embed({ budget: "10m" });
const hits = await crawler.find("pizza after midnight", {
rank: "hybrid",
fusionK: 60,
candidates: 50,
neighbors: 50,
});

Each hit has the fused score and the passage: the chunk of the page that is nearest to the question. The model stays on your computer, and its first use downloads it from the Hugging Face Hub. The library API gives each option, and the command line has embed and find --rank hybrid.