Skip to main content
Tutorial

Hybrid Search in Weaviate Over Web Data

Build hybrid search (BM25 + vectors) in Weaviate over crawled web pages: alpha tuning, fusion algorithms, chunking, and when hybrid beats pure vector search.

fastcrw
By RecepNovember 26, 202610 min read

Hybrid search in Weaviate combines BM25 keyword scoring with vector similarity

Weaviate's hybrid search runs a BM25 keyword query and a dense vector query against the same collection, then merges the two ranked lists into one score using a fusion algorithm. An alpha parameter (0 to 1) controls the blend: alpha=0 is pure BM25, alpha=1 is pure vector, and the useful range for most web content sits between 0.5 and 0.75. The result is a search that catches exact terms a pure embedding model would blur past, while still understanding paraphrase and intent.

What BM25 and vector search each miss on their own

Pure vector search embeds the query and the document into the same space and ranks by cosine or dot-product similarity. It is strong on paraphrase and conceptual match ("how do I cancel my plan" finds a page titled "Ending your subscription") but weak on exact tokens: product SKUs, error codes, version numbers, person names, and rare technical terms often get diluted in a dense embedding, because the model has learned to compress meaning, not preserve strings.

BM25 is the opposite. It is a term-frequency scoring function, the same family that powered search before embeddings existed: and it is exact on tokens: a query for ERR_CONNECTION_RESET or a part number like SKU-88421 matches BM25 precisely, because BM25 scores literal term overlap weighted by rarity (inverse document frequency) and length normalization. What it misses is synonymy and paraphrase: it has no notion that "cancel" and "end my subscription" mean the same thing.

Hybrid search exists because most real queries against web content: product docs, changelogs, support pages, pricing pages: mix both needs in one sentence: a conceptual intent plus a literal token the writer actually used.

rankedFusion vs relativeScoreFusion

Weaviate ships two fusion algorithms for combining the BM25 and vector result lists, set via fusion_type:

AlgorithmHow it scoresUse when
rankedFusionUses each document's rank position in the two lists (reciprocal rank fusion), ignores raw score magnitudeDefault, robust baseline; safe when you have not tuned anything yet
relativeScoreFusionNormalizes the raw BM25 and vector scores to 0-1 and combines them by magnitude, not just rankYour BM25 scores vary a lot in confidence (some queries match one exact term, others match five) and you want that reflected

In current Weaviate versions relativeScoreFusion is the default for new collections. Rank-based fusion is more predictable across corpora with wildly different document lengths; score-based fusion rewards strong exact matches more aggressively. Test both on a held-out query set before committing, the difference shows up most on queries with one dominant exact-match term.

When hybrid beats pure vector search

Hybrid search wins whenever the query set contains literal tokens the embedding model was not trained to preserve exactly. On web-sourced corpora: scraped docs, pricing pages, API references, changelogs. That is most of the time. Three concrete cases:

  • Exact identifiers. Error codes, API endpoint names, HTTP status codes, model names, version numbers. A user searching gpt-4.1-mini wants that string, not something "close" in embedding space.
  • Rare or coined terms. Product names, internal jargon, a company's own vocabulary for a feature. These terms are underrepresented in the embedding model's training data, so their vectors are noisy.
  • Acronyms and short queries. Short queries carry less semantic signal for the vector side to work with; BM25's exact-match behavior fills the gap.

Pure vector search still wins on genuinely open-ended, paraphrastic queries with no exact terms to anchor on: "why would someone choose a competitor over us" has no literal string to match, so BM25 contributes noise rather than signal in that case. If your query set is closer to that shape, alpha should lean high (0.8-0.9) or you should benchmark disabling BM25 entirely for that specific use case.

Getting web data into Weaviate: crawl, chunk, embed, import

Hybrid search is only as good as the corpus behind it. Web pages arrive as HTML with navigation, ads, and boilerplate mixed into the content you actually want indexed: feeding raw HTML into BM25 pollutes term frequencies with nav-menu text, and feeding it into an embedding model wastes tokens on the same noise. The fix is to scrape to clean markdown first, chunk on real structure, then embed and import.

fastCRW is a Firecrawl-API-compatible scrape/crawl engine, shipped as a single ~8 MB Rust binary, that returns clean markdown with boilerplate already stripped. Crawling a docs site or knowledge base:

curl -X POST https://api.fastcrw.com/v1/crawl \
  -H "Authorization: Bearer crw_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.example.com",
    "maxDepth": 2,
    "limit": 200,
    "scrapeOptions": { "formats": ["markdown"], "onlyMainContent": true }
  }'

Poll the returned job with GET /v1/crawl/{id} until status: "completed", then chunk each page's markdown on headings (so a chunk boundary lines up with a section, not a mid-sentence cut) and embed each chunk before importing:

import weaviate
from weaviate.classes.config import Configure, Property, DataType

client = weaviate.connect_to_local()

client.collections.create(
    "WebPage",
    vectorizer_config=Configure.Vectorizer.text2vec_openai(),
    properties=[
        Property(name="content", data_type=DataType.TEXT),
        Property(name="url", data_type=DataType.TEXT),
        Property(name="title", data_type=DataType.TEXT),
    ],
)

collection = client.collections.get("WebPage")
with collection.batch.dynamic() as batch:
    for chunk in chunks:  # {"content", "url", "title"} from the fastCRW crawl output
        batch.add_object(properties=chunk)

Using text2vec_openai (or any Weaviate-managed vectorizer module) means Weaviate embeds on import and on query automatically. You only supply the text. If you instead bring your own embeddings, set vectorizer_config=Configure.Vectorizer.none() and pass vector= on each object.

Running the hybrid query

Once the collection is populated, a hybrid query is one call:

response = collection.query.hybrid(
    query="rate limit error on the batch endpoint",
    alpha=0.6,
    fusion_type="relativeScoreFusion",
    limit=10,
)

for obj in response.objects:
    print(obj.properties["url"], obj.properties["title"])

Filter alongside the hybrid query with standard Weaviate Filter objects: for example restricting to pages crawled after a given date, or scoped to one subdomain: without giving up the BM25/vector blend. Hybrid search composes with filters exactly like a pure vector query does.

Tuning alpha for your corpus

There is no universal alpha; it depends on how literal your query set is. A practical procedure:

  1. Collect 30-50 real or representative queries against your corpus, with the expected top result marked for each.
  2. Run the set at alpha values of 0.3, 0.5, 0.7, and 0.9 (plus 0 and 1 as BM25-only and vector-only baselines).
  3. Score each run with a simple metric like recall@5 or MRR against your marked answers.
  4. Pick the alpha that wins on your actual queries, not a default: docs-heavy corpora with lots of exact identifiers usually land lower (0.4-0.6); conceptual FAQ-style corpora usually land higher (0.7-0.85).

Re-run this check whenever the corpus changes shape significantly (a new content type, a different site added to the crawl): alpha tuned on one corpus does not automatically transfer to another.

Where this pipeline is not the right fit

Hybrid search adds real value when your query mix has literal tokens worth catching. If your corpus is small (a few hundred documents) and queries are consistently paraphrastic, the BM25 half of the blend may add complexity without moving recall: measure before assuming hybrid wins. And if your pages are behind heavy anti-bot protection or require authenticated sessions to render, plan for that at the crawl stage: fastCRW's renderer escalates from plain HTTP through a JS-rendering tier automatically, but a login-gated intranet still needs session cookies passed explicitly, and no scraper is a substitute for a proper API export if the source system offers one.

For self-hosting the crawl layer, fastCRW's engine is AGPL-3.0 and free to run yourself; the managed API at fastcrw.com starts from $13/mo with 1,000 free credits and no card required if you would rather not operate the crawler. See the benchmarks page for scrape recall numbers across tested tools, and the structured extraction guide if you need typed fields alongside the markdown chunks you feed into Weaviate.

Sources

  • Weaviate documentation: Hybrid search (query.hybrid, alpha, fusion_type)
  • Weaviate documentation: Fusion algorithms (rankedFusion, relativeScoreFusion)
  • fastCRW REST API reference, /v1/crawl and /v1/scrape
  • fastCRW scrape truth-recall benchmark, diagnose_3way.py on Firecrawl's public 1,000-URL dataset, 2026-05-08

FAQ

Frequently asked questions

What is hybrid search in Weaviate?
Hybrid search runs a BM25 keyword query and a dense vector query against the same collection and merges the two ranked lists with a fusion algorithm. An alpha parameter from 0 to 1 controls the blend, 0 is pure BM25, 1 is pure vector: so the same query benefits from exact term matching and semantic similarity at once.
What alpha value should I use for hybrid search?
There is no universal default. Test alpha values of 0.3, 0.5, 0.7, and 0.9 against 30-50 representative queries with known expected results, and pick whichever wins on recall@5 or MRR for your corpus. Docs-heavy corpora with exact identifiers usually land lower (0.4-0.6); conceptual, paraphrastic corpora usually land higher (0.7-0.85).
Should I use rankedFusion or relativeScoreFusion in Weaviate?
relativeScoreFusion normalizes and combines the raw BM25 and vector scores by magnitude, which rewards strong exact matches more. rankedFusion uses reciprocal rank fusion based only on each result's position in the two lists, which is more predictable across corpora with widely varying document lengths. Test both on a held-out query set rather than assuming one is universally better.
How do I get clean web content into Weaviate for hybrid search?
Scrape to clean markdown first rather than importing raw HTML, since navigation and boilerplate pollute both BM25 term frequencies and embedding quality. fastCRW's /v1/crawl endpoint returns markdown with onlyMainContent stripping boilerplate; chunk on headings so chunk boundaries align with document sections, then embed and batch-import each chunk into a Weaviate collection.
When does hybrid search not help over pure vector search?
When query sets are consistently open-ended and paraphrastic with no exact literal terms to anchor on, BM25 can add noise rather than signal, and a high alpha (0.8-0.9) or pure vector search performs comparably. Hybrid search earns its complexity mainly on corpora with identifiers, product names, error codes, or other exact tokens the query set actually uses.

Get Started

Try fastCRW free

Run a live request in the playground — no signup required. Or grab a free API key with 1000 free credits, no credit card.

Continue exploring

More tutorial posts

View category archive