This repository is dedicated to porting Apache Lucene from Java to Kotlin Multiplatform (KMP) to create a cross-platform library called lucene-kmp. The project aims to make Lucene's powerful search capabilities available across multiple platforms through Kotlin Multiplatform technology.
This repository contains two git submodules:
-
lucene - The original Apache Lucene Java codebase (read-only)
- Fixed at commit:
ec75fcad5a4208c7b9e35e870229d9b703cda8f3 - URL: https://github.com/apache/lucene.git
- Fixed at commit:
-
lucene-kmp - The Kotlin Multiplatform port (work-in-progress)
The porting process follows these guidelines:
- The Java version of Apache Lucene is read-only and should never be modified.
- The Java version is fixed at commit
ec75fcad5a4208c7b9e35e870229d9b703cda8f3or (ec75fcain short) until the initial porting is complete. - Do not run
git pullorgit fetchin the Java lucene submodule as the porting is based on the specific commit. - The porting work involves converting Java code to Kotlin Common code to create a Kotlin Multiplatform library.
This repository structure is specifically designed to facilitate AI agents in the porting work by providing access to both the original Java code and the Kotlin port in a single repository. This setup allows for easier comparison and reference between the two codebases during the porting process.
The porting and development of lucene-kmp is organized into several distinct phases:
- Goal:
Port the core Lucene classes necessary to write (create) an index. - Includes:
Index writing classes (e.g.,IndexWriter,IndexWriterConfig), required document and field types, and storage components such asFSDirectory. - Outcome:
lucene-kmp can write indices on supported platforms.
- Goal:
Port essential classes to enable searching of indices. - Includes:
Index reading classes (e.g.,DirectoryReader,StandardDirectoryReader), query parsing and execution components, and required storage support. - Outcome:
lucene-kmp can run basic search queries over indices.
- Goal:
Ensure functional correctness and performance. - Includes:
Porting/writing test suites, CI integration across platforms, and benchmarking against the original Java implementation.
- Goal:
Maintain currency with the upstream Apache Lucene project. - Includes:
Porting subsequent commits from upstream on an ongoing basis (potentially using automation), with periodic updates to the Kotlin Multiplatform port.
After completing the initial port of all components and tests from the fixed Java version:
- The project will proceed with commit-by-commit updates, following the subsequent commits in the Java Lucene repository.
- Each change in the Java version will be ported to the lucene-kmp project to keep it up-to-date with the latest Lucene features and improvements.
The lucene-kmp library targets the following platforms:
- JVM
- Android
- iOS (iosX64, iosArm64, iosSimulatorArm64)
For detailed progress on the porting effort, please refer to the PROGRESS.md file in the lucene-kmp submodule.
If you're interested in contributing to the porting effort, please follow these steps:
- Understand the original Java implementation in the lucene submodule
- Port the code to Kotlin following Kotlin Multiplatform best practices
- Ensure all tests pass for the ported code
- Submit your changes to the lucene-kmp repository
Remember that the Java version should remain untouched, and all development work should happen in the lucene-kmp submodule.