The library provides three async loader functions for lazy-loading datasets. These loaders use dynamic imports for code splitting, keeping your initial bundle size minimal.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/adelpro/quran-search-engine/llms.txt
Use this file to discover all available pages before exploring further.
Overview
All data loaders are asynchronous and should be called once at app startup:Load Quran data
loadQuranData()
Loads the complete Quran dataset containing 6,236 verses with text in both standard and Uthmani scripts.
Returns: Promise<QuranText[]>
Use case: Load once at app startup (browser or Node), then reuse in searches.
The
QuranText type includes fields like sura_id, aya_id, gid, page_id, juz_id, sura_name, uthmani, standard, and more.Load morphology data
loadMorphology()
Loads morphological analysis data (lemmas and roots) for all verses. This large dataset is loaded asynchronously to avoid increasing the initial bundle size.
Returns: Promise<Map<number, MorphologyAya>>
Use case: Enable lemma/root search and scoring.
Load word map
loadWordMap()
Loads the word map dictionary that maps normalized Arabic tokens to their canonical lemma and root forms.
Returns: Promise<WordMap>
Use case: Map normalized query tokens to their canonical lemma/root for linguistic matching.
Error handling
All loader functions include built-in error handling. If a required data file is missing, they throw descriptive errors:Data sources
The bundled lemma (morphology) data and word map were downloaded from Quranic Arabic Corpus v4.0: https://corpus.quran.com
Implementation details
Fromsrc/utils/loader.ts:9-31:
- Uses dynamic imports for automatic code splitting
- Handles both default and named exports for bundler compatibility
- Transforms the array into a Map for optimal lookup performance
- Validates data structure before adding to the map