Apache Lucene APIs for Kotlin Multiplatform

lucene-kmp

On-device indexing and relevance-ranked full-text search for Kotlin Multiplatform Android, iOS, desktop, and native apps.

  • JVM
  • Android
  • iOS
  • macOS
  • Linux
  • Windows

Local search without a backend service

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.

Maven Central
implementation("org.gnit.lucene-kmp:lucene-kmp-core:10.2.0-alpha14")
implementation("org.gnit.lucene-kmp:lucene-kmp-queryparser:10.2.0-alpha14")

Search building blocks for app data

Full-text indexing

Build and query local indexes for offline-first apps, private user data, and content-heavy screens.

Relevance ranking

Return the best matches first instead of only exact substring matches.

Analyzer pipelines

Normalize text with tokenization, case folding, stop words, stemming, and language-specific analysis.

Rich queries

Use phrases, boolean queries, wildcard queries, range queries, and query parsing.

Fielded documents

Index structured records with searchable and stored fields such as title, body, tags, and dates.

Incremental updates

Add, update, and delete documents as app data changes without rebuilding the whole index.

Focused on the core indexing and search path

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.

core97%Indexing and searching
analysis/common83%Language analyzers
kuromoji98%JapaneseAnalyzer
morfologik100%Polish and Ukrainian analyzers
nori100%KoreanAnalyzer
smartcn100%SmartChineseAnalyzer
codecs59%Index format codecs
test-framework77%Shared test classes

Use both for the jobs they do best

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.

Lucene

Inverted indexes, relevance scoring, analyzer pipelines, phrase and fuzzy queries, fielded document search.

SQL

Tables, relations, transactions, joins, migrations, exact lookups, range queries, and source-of-truth storage.