feat(search): index PDF text, OCR scanned PDFs on import
All checks were successful
CI / Windows build (push) Successful in 15m50s
All checks were successful
CI / Windows build (push) Successful in 15m50s
Search now covers handwriting, the PDF text layer, AND scanned (rasterized) PDFs. - PdfTextIndexer runs at import: sums the embedded text layer across pages; if present it stores that as the document body, otherwise the PDF is rasterized and its rendered pages are OCR'd in the background. The result lands in the sidecar `pageText` field (distinct from `ocrText`, the handwriting OCR). Idempotent (skips a sidecar that already has pageText); degrades gracefully with no OCR engine. - pdfrx_page_text_source abstracts text/render so it's testable. - VaultSearchIndex now harvests title + typed text + handwriting OCR + PDF pageText, so search finds notes, typed PDFs and scanned PDFs. analyze clean, 409 tests green.
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../services/ocr_service.dart';
|
||||
import '../services/pdf_text_indexer.dart';
|
||||
import '../services/pdfrx_page_text_source.dart';
|
||||
|
||||
enum OcrStatus { none, processing, done, failed }
|
||||
|
||||
final ocrServiceProvider = Provider<OcrService>((ref) => OcrService());
|
||||
|
||||
/// The import-time PDF document-body indexer, wired to the pdfrx-backed embedded
|
||||
/// text + page-render OCR sources (see [PdfrxPageTextSource]). The import flow
|
||||
/// fires [PdfTextIndexer.indexPdf] (fire-and-forget) so a scanned PDF's text
|
||||
/// becomes searchable in the background without blocking the editor opening.
|
||||
final pdfTextIndexerProvider = Provider<PdfTextIndexer>(
|
||||
(ref) => PdfTextIndexer(
|
||||
loadEmbeddedText: PdfrxPageTextSource.loadEmbeddedText,
|
||||
ocrPages: PdfrxPageTextSource.ocrPages,
|
||||
),
|
||||
);
|
||||
|
||||
/// Tracks local OCR processing status per note ID.
|
||||
///
|
||||
/// This map only ever holds an entry per note that has had OCR triggered in
|
||||
|
||||
Reference in New Issue
Block a user