lunr
A Python implementation of Lunr.js
Decision gist · record as of 2026-08-14
Yes, if you need lightweight full-text search without external infrastructure and your document set is manageable in memory. The low install friction, permissive MIT license, and broad Python version support (3.9–3.13) make it a practical choice for prototyping or small-scale use. However, the aging maintenance status (524 days since last release) means you should verify compatibility with your specific Python version and use case before relying on it for production systems.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python wheel with only two lightweight runtime dependencies (importlib-metadata and typing-extensions).
- Maintenance is aging—last release was 524 days ago—but the repository is active and not archived, with a recent commit on 2025-03-08.
License · maintenance · safety
MIT (permissive) — MIT license (permissive): you can use, modify, and distribute lunr freely in both open-source and commercial projects with minimal restrictions, provided you include the license notice.
last release 2025-03-08 (524 days) · last repo commit 2025-03-08 · 203 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 291,159 downloads/mo, #7,973 on PyPI
Alternatives
Verify before relying
pip install lunr
from lunr import lunr
documents = [
{'id': 'a', 'title': 'Mr. Green kills Colonel Mustard', 'body': 'Mr. Green killed Colonel Mustard in the study with the candlestick.'},
{'id': 'b', 'title': 'Plumb waters plant', 'body': 'Professor Plumb has a green plant in his study'}
]
idx = lunr(ref='id', fields=('title', 'body'), documents=documents)
results = idx.search('kill')- Whether the aging maintenance status (524 days since last release) affects compatibility with recent Python versions or introduces unfixed bugs.
- Performance characteristics for document sets larger than the test corpus mentioned in the documentation.
What it is and what it does
Lunr is a Python port of the JavaScript Lunr.js library, designed to provide full-text search capabilities without the overhead of a dedicated search server like Elasticsearch. It works by parsing a collection of documents (represented as dictionaries) and building an inverted index that enables fast text queries. The index is kept entirely in memory, making it suitable for prototyping, smaller applications, or situations where deploying a full-scale search infrastructure is impractical.
A key feature is interoperability with Lunr.js: you can build an index in Python and serialize it for use in a browser-based frontend, or vice versa. This is particularly useful for static documentation sites (like those built with MkDocs) where you want to pre-compute the search index on the backend to minimize startup time in the browser. The trade-off is that you must recreate or reload the index when your application starts, since it exists only in memory.
Use it for
- Add full-text search to a documentation site (e.g., MkDocs) by pre-indexing pages in Python and serving the serialized index to the frontend.
- Prototype a search feature for a web application before committing to Elasticsearch or another production search engine.
- Search a small-to-medium corpus of documents in a Python application without external dependencies or infrastructure.
- Build a backend search index that can be shared with a JavaScript frontend using the same Lunr.js format.
- Implement keyword-based retrieval in a data processing pipeline where documents are already in memory.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need lightweight full-text search without external infrastructure and your document set is manageable in memory.
The low install friction, permissive MIT license, and broad Python version support (3.9–3.13) make it a practical choice for prototyping or small-scale use. However, the aging maintenance status (524 days since last release) means you should verify compatibility with your specific Python version and use case before relying on it for production systems.
Install
lunr on PyPI
Before you install
Low friction: pure Python wheel with only two lightweight runtime dependencies (importlib-metadata and typing-extensions). Maintenance is aging—last release was 524 days ago—but the repository is active and not archived, with a recent commit on 2025-03-08.
License in practice
MIT license (permissive): you can use, modify, and distribute lunr freely in both open-source and commercial projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install lunr
from lunr import lunr
documents = [
{'id': 'a', 'title': 'Mr. Green kills Colonel Mustard', 'body': 'Mr. Green killed Colonel Mustard in the study with the candlestick.'},
{'id': 'b', 'title': 'Plumb waters plant', 'body': 'Professor Plumb has a green plant in his study'}
]
idx = lunr(ref='id', fields=('title', 'body'), documents=documents)
results = idx.search('kill')
Verify before relying
- Whether the aging maintenance status (524 days since last release) affects compatibility with recent Python versions or introduces unfixed bugs.
- Performance characteristics for document sets larger than the test corpus mentioned in the documentation.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesimportlib-metadatatyping-extensions |
| Maintenance | Aging 524 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 291,159 / month, #7,973 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Text Processing |
Evidence: lunr-0.8.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “full text search python”
- lunrLunr is a lightweight, in-memory full-text search library that builds…
- Whoosh-ReloadedWhoosh-Reloaded is a pure-Python full-text indexing and search…
- sqlalchemy-searchableAdds fulltext search capabilities to SQLAlchemy models using…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also pagefind-bin · llama-index · llama-index-retrievers-bm25 · pagefind · rank-bm25 · voyager · pygmars · tinysegmenter · PyStemmer · lightrag-hku