--- id: lunr version: "0.8.0" license: MIT license_treatment: permissive maintenance: aging --- # lunr — A Python implementation of Lunr.js License: permissive · Maintenance: aging · Downloads: 291.2K/mo ## 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 above — verify before relying. Lunr is a lightweight, in-memory full-text search library that builds an inverted index from a set of documents and performs fast text searches without requiring a separate search server. 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 pip install lunr uv add lunr poetry add lunr ## Installing lunr 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_current - Install friction: low - Maintenance: aging - Downloads: 291.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags full text search python, lightweight search index, in-memory search library, lunr.js python port, document indexing and retrieval, simple search solution, inverted index search, search-indexing, lunr-js-compatible [View on SkillFed](https://skillfed.io/packages/lunr) · [View on PyPI](https://pypi.org/project/lunr/)