Files
ReSearch/README.md
T
2026-07-06 09:29:50 +08:00

4.7 KiB

ReSearch

A fast Android dictionary reader for DSL-format dictionaries.

ScreenshotsFeaturesArchitecturePipelineBuild

ReSearch is an Android dictionary reader for DSL-format dictionaries. It can download, import, index, and search multiple dictionaries.

The app stores dictionaries as DictZip files and builds compact binary indexes for fast offline headword search.

Screenshots

ReSearch search screen ReSearch article screen

Features

  • Fast headword search across multiple DSL dictionaries.
  • Import local .dsl, .dsl.gz, and .dsl.dz dictionary files.
  • Download dictionaries from configured URLs.
  • Automatic extraction, DictZip compression, and indexing.
  • Offline search after dictionaries are indexed.
  • Random-access article loading from DictZip dictionaries.
  • Background processing with progress shown in Settings and notifications.
  • Dictionary management with enable, disable, update, and delete actions.
  • Material 3 interface with light, dark, and system themes.
  • English and Russian localization.
  • About screen with open source license information.

Architecture

ReSearch is an Android app written in Kotlin and Jetpack Compose.

com.example.research/
├── common/   # shared progress, UI, file, archive, notification utilities
├── core/     # domain models, source validation, operation results
├── data/     # DictZip, DSL parsing, indexing, paging, repositories
├── feature/  # search, dictionary download, local import workflows
└── ui/       # Compose screens, article view, settings, navigation

State is exposed through Kotlin Flow and collected by Compose screens. Long-running work uses coroutines and foreground services where Android requires visible progress.

Dictionary Pipeline

ReSearch supports both downloaded and locally imported dictionaries.

Download flow:

  1. Resolve enabled dictionary source URLs.
  2. Download dictionary archives with OkHttp.
  3. Report progress through a foreground notification and Settings UI.
  4. Extract archives when needed.
  5. Convert raw DSL files to DictZip.
  6. Build missing indexes.

Import flow:

  1. Copy user-selected files into the app dictionary directory.
  2. Extract archives or convert existing DSL files to DictZip.
  3. Build indexes after import.
  4. Refresh the dictionary list as dictionaries become available.

Indexed dictionaries remain usable offline.

The indexer reads DSL files while preserving byte offsets for article lookup. It groups alternate headwords that point to the same article body, normalizes searchable words, and writes a compact binary .idx file.

For small dictionaries, entries can be sorted in memory. For large dictionaries, ReSearch uses external sorting to keep memory usage bounded.

The sparse table lets search jump into the index without scanning the full file. Article offsets point back into the DictZip dictionary, allowing ReSearch to load article text by byte range instead of reading the whole dictionary into memory.

Responsiveness

Dictionary processing can involve large files, so heavy work runs off the main thread:

  • download, extraction, compression, indexing, and file operations use background dispatchers;
  • indexing is serialized to avoid CPU and I/O contention;
  • progress updates are throttled before reaching Compose;
  • oversized article blocks are split into lazy-list chunks so reference-heavy articles render without freezing a frame on text measurement;
  • orientation changes are handled without Activity recreation;
  • memory pressure triggers cache trimming for indexes, search results, article charset data, and DictZip chunks;
  • out-of-memory conditions on critical paths are handled explicitly where possible.

The main search screen remains usable as long as at least one indexed dictionary is available.

Tech Stack

  • Kotlin 2.4.0
  • Jetpack Compose (BOM 2026.06.01)
  • Material 3
  • Coroutines and Flow 1.11.0
  • DataStore Preferences 1.2.1
  • Paging 3.5.0
  • OkHttp 5.4.0
  • kotlinx.serialization 1.11.0
  • AboutLibraries 15.0.3 metadata generation
  • Android Gradle Plugin 9.2.1

Build

./gradlew :app:assembleRelease

The release APK targets arm64-v8a. English and Russian resources are packaged together.

License

MIT