Apache Lucene APIs for Kotlin Multiplatform
On-device indexing and relevance-ranked full-text search for Kotlin Multiplatform Android, iOS, desktop, and native apps.
Overview
lucene-kmp ports Apache Lucene to common Kotlin so mobile, desktop, and native apps can build local indexes, run analyzer-based queries, and return relevance-ranked results while keeping private user data on device.
implementation("org.gnit.lucene-kmp:lucene-kmp-core:10.2.0-alpha14")
implementation("org.gnit.lucene-kmp:lucene-kmp-queryparser:10.2.0-alpha14")Features
Build and query local indexes for offline-first apps, private user data, and content-heavy screens.
Return the best matches first instead of only exact substring matches.
Normalize text with tokenization, case folding, stop words, stemming, and language-specific analysis.
Use phrases, boolean queries, wildcard queries, range queries, and query parsing.
Index structured records with searchable and stored fields such as title, body, tags, and dates.
Add, update, and delete documents as app data changes without rebuilding the whole index.
Porting status
The port prioritizes Lucene core APIs, query parsing, common analyzers, codecs, and shared test support. API compatibility with Apache Lucene is a goal while the project remains experimental.
Lucene or SQL
SQLDelight and Room KMP are strong source-of-truth stores for relational app data. lucene-kmp is for search boxes over text: ranking, tokenization, stemming, phrase queries, typo-tolerant search, and fast lookup across fields.
Inverted indexes, relevance scoring, analyzer pipelines, phrase and fuzzy queries, fielded document search.
Tables, relations, transactions, joins, migrations, exact lookups, range queries, and source-of-truth storage.