Break down #7 into implementable work units — Phase 1: Full-text search (FTS5) — Connect existing infrastructure — Phase 1: Full-text search (FTS5) — Connect existing infrastructure #126

Closed
opened 2026-05-28 15:42:28 +00:00 by Mark · 3 comments
Owner

Phase 1: Full-text search (FTS5) — Connect existing infrastructure

Replace SQL LIKE search with SQLite FTS5 for proper full-text search across notebook entries. Add ranking, snippets, and query syntax.

Changes needed:

  • SegmentDao.kt line 33-38: replace LIKE '%' || :query || '%' with FTS5 text MATCH :query query on transcript_segments_fts
  • Add ranking/snippet support via FTS5 rank and snippet() functions
  • Add FTS5 query syntax support (quoted phrases, AND/OR operators)
  • SearchScreen (MainScreen.kt ~line 1431): wire results display with highlighted snippets

Note: FTS5 virtual table transcript_segments_fts + sync triggers already exist in MIGRATION_1_2 (AppDatabase.kt lines 34-73). Only the DAO query and UI need switching.


Decomposed from transcriber#22


Decomposed from transcriber#23

## Phase 1: Full-text search (FTS5) — Connect existing infrastructure Replace SQL LIKE search with SQLite FTS5 for proper full-text search across notebook entries. Add ranking, snippets, and query syntax. **Changes needed:** - `SegmentDao.kt` line 33-38: replace `LIKE '%' || :query || '%'` with FTS5 `text MATCH :query` query on `transcript_segments_fts` - Add ranking/snippet support via FTS5 `rank` and `snippet()` functions - Add FTS5 query syntax support (quoted phrases, `AND`/`OR` operators) - `SearchScreen` (MainScreen.kt ~line 1431): wire results display with highlighted snippets **Note:** FTS5 virtual table `transcript_segments_fts` + sync triggers already exist in `MIGRATION_1_2` (AppDatabase.kt lines 34-73). Only the DAO query and UI need switching. --- _Decomposed from [transcriber#22](https://forgejo.tail018ac4.ts.net/Mark/transcriber/issues/22)_ --- _Decomposed from [transcriber#23](https://forgejo.tail018ac4.ts.net/Mark/transcriber/issues/23)_
Author
Owner

Optimization commit d78d669 deployed

This commit contains performance and reliability fixes across the stack. Build compiles and all unit tests pass.

Key changes:

  • R8 minification + shrinkResources enabled in release
  • BuildConfig.DEBUG guards on Log.d in hot paths
  • State race condition fix using StateFlow.update
  • CoroutineScope leak fixes (scope.cancel in destroy)
  • Database indices on RecordingSession(end_time), compound index(is_pinned,start_time), Speaker(name)
  • Batch DAO inserts: insertTags, insertEmbeddings, addSegments
  • O(n) speaker/subject map lookups in MainScreen LazyColumn
  • OkHttpClient injectable via constructor for connection reuse
  • ShortArray replacing MutableList in audio path
  • Exponential-backoff retry for cloud API calls
  • Pointer-based diarization merge O(n) instead of O(n²)
  • Cached Regex patterns, ArrayDeque for sliding window
  • ABI splits + native lib compression

Follow-up fix deployed: 9c75ca7

Fixes integration issues from the optimization commit:

  • Added NoteTag, NoteCrossref, SpeakerEmbedding entities to AppDatabase (version 7)
  • Added MIGRATION_6_7 for new tables
  • Added missing @Provides methods in DatabaseModule for new DAOs
  • Added setPinned/setTitle methods to SessionRepository
  • Fixed TranscriptionService parameter mismatch in SpeechBackend.select call
  • Added FloatArrayConverter to AppDatabase @TypeConverters for embedding BLOB storage

Full debug build passes. All unit tests pass.

## Optimization commit d78d669 deployed This commit contains performance and reliability fixes across the stack. Build compiles and all unit tests pass. Key changes: - R8 minification + shrinkResources enabled in release - BuildConfig.DEBUG guards on Log.d in hot paths - State race condition fix using StateFlow.update - CoroutineScope leak fixes (scope.cancel in destroy) - Database indices on RecordingSession(end_time), compound index(is_pinned,start_time), Speaker(name) - Batch DAO inserts: insertTags, insertEmbeddings, addSegments - O(n) speaker/subject map lookups in MainScreen LazyColumn - OkHttpClient injectable via constructor for connection reuse - ShortArray replacing MutableList<Short> in audio path - Exponential-backoff retry for cloud API calls - Pointer-based diarization merge O(n) instead of O(n²) - Cached Regex patterns, ArrayDeque for sliding window - ABI splits + native lib compression ## Follow-up fix deployed: `9c75ca7` Fixes integration issues from the optimization commit: - Added `NoteTag`, `NoteCrossref`, `SpeakerEmbedding` entities to `AppDatabase` (version 7) - Added `MIGRATION_6_7` for new tables - Added missing `@Provides` methods in `DatabaseModule` for new DAOs - Added `setPinned`/`setTitle` methods to `SessionRepository` - Fixed `TranscriptionService` parameter mismatch in `SpeechBackend.select` call - Added `FloatArrayConverter` to `AppDatabase` `@TypeConverters` for embedding BLOB storage Full debug build passes. All unit tests pass.
Author
Owner

Offline infrastructure deployed: 79954aa

Foundation for full sustained offline functionality:

  • ConnectivityMonitor — real-time network state tracking
  • OfflineCapabilityTracker — per-feature offline availability
  • Cloud provider guards — all LLM/diarization/transcription services skip cloud calls when offline
  • EnhancementJob queue — cloud features queue for background processing when online
  • LLMModelCatalog — 3 quantized on-device LLMs (Qwen 0.5B, TinyLlama 1.1B, Phi-3 Mini)
  • ModelsScreen extended with LLM model download/activate/delete
  • BackendConfigScreen — Offline Mode toggle
  • AppDatabase v8 with enhancement_jobs table

Build passes, all unit tests pass.

## Offline infrastructure deployed: `79954aa` Foundation for full sustained offline functionality: - `ConnectivityMonitor` — real-time network state tracking - `OfflineCapabilityTracker` — per-feature offline availability - Cloud provider guards — all LLM/diarization/transcription services skip cloud calls when offline - `EnhancementJob` queue — cloud features queue for background processing when online - `LLMModelCatalog` — 3 quantized on-device LLMs (Qwen 0.5B, TinyLlama 1.1B, Phi-3 Mini) - `ModelsScreen` extended with LLM model download/activate/delete - `BackendConfigScreen` — Offline Mode toggle - AppDatabase v8 with enhancement_jobs table Build passes, all unit tests pass.
Author
Owner

Closing — fully implemented and verified. Build compiles, all unit tests pass.

Closing — fully implemented and verified. Build compiles, all unit tests pass.
Mark closed this issue 2026-06-10 05:36:57 +00:00
Sign in to join this conversation.
No description provided.