DocumentSearchService class

Generic document search service. Allows searching within OCR-extracted text from any document type.

Constructors

DocumentSearchService({required String text, String? fileName, String? documentType})

Properties

charCount → int
Total character count.
no setter
documentType → String?
Document type if detected.
final
fileName → String?
Source file name (optional, for display purposes).
final
fullText → String
The full OCR text.
no setter
hashCode → int
The hash code for this object.
no setterinherited
lineCount → int
Total number of non-empty lines.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
wordCount → int
Total word count.
no setter

Methods

countMatches(String query, {bool caseSensitive = false}) → int
Find all occurrences of a pattern and return count.
extractDates() → List<ExtractedDate>
Extract all dates from the document.
extractLabelValues({List<String>? targetLabels}) → Map<String, String>
Extract all values matching a label pattern. E.g., "Account Number", "Name", etc. Looks for patterns like "Label: Value" or "Label - Value".
extractNumbers({bool includeDecimals = true}) → List<ExtractedNumber>
Extract all numbers from the document.
findFieldValue(List<String> labelKeywords) → String?
Find specific field value by label keywords. Searches for common patterns like "Account No:", "Account Number -", etc.
findLinesContaining(List<String> keywords, {bool matchAll = false}) → List<SearchMatch>
Get lines containing specific keywords.
highlightInText(String query, {bool caseSensitive = false}) → String
Highlight search results in HTML format (for rich text display).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Search for a query string in the document. Returns list of SearchMatch with context.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited