---
title: "BM25 is only as good as your tokens"
description: "Lakebase Search's new lakebase_tokenizer extension moves Postgres text-search synonym and stop-word dictionaries from server-side files into SQL tables, so managed and branchable Neon databases can define custom vocabularies with INSERT."
url: "https://swe.quest/articles/bm25-is-only-as-good-as-your-tokens-c687d331681bdece"
canonical: "https://neon.com/blog/bm25-is-only-as-good-as-your-tokens"
source: "Neon"
published: "2026-10-07"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["search","postgres"]
---

# BM25 is only as good as your tokens

A post on [Neon](https://swe.quest/sources/neon.md), published 2026-10-07, 8 min read, How-to. Original: [https://neon.com/blog/bm25-is-only-as-good-as-your-tokens](https://neon.com/blog/bm25-is-only-as-good-as-your-tokens)

## Summary

Lakebase Search's new lakebase\_tokenizer extension moves Postgres text-search synonym and stop-word dictionaries from server-side files into SQL tables, so managed and branchable Neon databases can define custom vocabularies with INSERT. Because BM25 only scores the tokens a dictionary produces, unifying variants like k8s/kube/kubernetes, stripping accents and dropping filler words changes both recall and IDF-driven scores. In a support-ticket example, the query 'pg creds zurich' goes from one match to three, and 'please help, kube pods crashing' goes from zero AND-filtered matches to two. Merged synonyms also lower inflated rarity scores for rare spellings.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Search](https://swe.quest/tags/search.md) (Backend & APIs)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- Postgres full-text search ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- tsvector and tsquery
- BM25 ranking basics ([easy posts on Recommendations & ranking](https://swe.quest/tags/recommendation-systems.md?difficulty=easy))

## Keywords

Lakebase Search, lakebase\_tokenizer, lakebase\_bm25, BM25, Neon, tsvector, GIN

## Related posts

- [CommSync Runs Text, Vector, and Hybrid Search on Postgres with Lakebase Search](https://swe.quest/articles/commsync-runs-text-vector-and-hybrid-search-on-postgres-with-lakebase-search-8b687b59899ef5ac.md): Neon · 2026-07-30 · Medium · 5 min read · Search, PostgreSQL, Vector search, RAG & retrieval
  CommSync, a unified SMS/email inbox, runs keyword, semantic and hybrid search entirely in Postgres using Neon's Lakebase Search extensions. lakebase\_text provides BM25 search with top-K pushdown over tsvector, and lakebase\_vector is a pgvector-compatible drop-in with an ANN index.
- [Neon Docs search is now built on Neon](https://swe.quest/articles/neon-docs-search-is-now-built-on-neon-6358bcc8a0cf6214.md): Neon · 2026-10-26 · Medium · 6 min read · Search, PostgreSQL, Vector search, Caching, AI agents
  Neon's docs search now runs entirely on its own stack: Lakebase Postgres with the lakebase\_vector (pgvector-compatible ANN) and lakebase\_text (BM25) extensions, a Hono API on Neon Functions, and Neon AI Gateway for embeddings and reranking.
- [Lakebase Search: vector and BM25 on Neon](https://swe.quest/articles/lakebase-search-vector-and-bm25-on-neon-b760351851c96b48.md): Neon · 2026-07-02 · Medium · 7 min read · Vector search, Search, PostgreSQL, Storage engines
  Neon's Lakebase Search adds two Postgres extensions, lakebase\_vector (IVF partitioning plus RaBitQ quantization, pgvector-compatible) and lakebase\_text (a BM25-native index with Block-Max WAND top-K pushdown), designed for Neon's separated compute and object-storage tiers.
- [Announcing pg\_tiktoken: A Postgres Extension for Fast BPE Tokenization](https://swe.quest/articles/announcing-pg-tiktoken-a-postgres-extension-for-fast-bpe-tokenization-f53006f2756f2730.md): Neon · 2023-03-14 · Medium · 5 min read · PostgreSQL, LLMs, SQL
  pg\_tiktoken is a Postgres extension on Neon that wraps OpenAI's tiktoken BPE tokenizer, exposing tiktoken\_encode (returns token IDs) and tiktoken\_count (returns token counts) for encodings such as cl100k\_base, p50k\_base, p50k\_edit and r50k\_base or their model names.
- [pg\_search is Available on Neon](https://swe.quest/articles/pg-search-is-available-on-neon-98d919ff82afb749.md): Neon · 2025-03-18 · Medium · 8 min read · PostgreSQL, Search, Performance engineering
  ParadeDB's pg\_search extension, now available on Neon in AWS regions, adds a Tantivy-powered BM25 inverted index to Postgres, bringing relevance ranking, fuzzy matching, faceting, highlighting and JSON-aware search that native tsvector/GIN full-text search lacks.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
