Install the package
Complete the installation to add quran-search-engine to your project.
Load the data
Load the Quran dataset, morphology map, and word map at app startup:
Examples assume an async context (Node 18+, ESM, or browser).
Search options
Thesearch function accepts the following options to control matching behavior:
| Option | Type | Description |
|---|---|---|
lemma | boolean | Enable lemma-based matching (morphological analysis) |
root | boolean | Enable root-based matching (word etymology) |
fuzzy | boolean | Enable fuzzy fallback matching (optional, defaults to true) |
Match scoring
Each match type has a different score weight:| Match type | Score per hit |
|---|---|
| Exact | +3 |
| Lemma | +2 |
| Root | +1 |
| Fuzzy | +0.5 (fallback only) |
Pagination
Control the number of results returned using pagination options:Search response structure
TheSearchResponse object contains:
results: Array ofScoredQuranTextobjects with match metadatacounts: Breakdown of matches by type (exact, lemma, root, fuzzy)pagination: Current page info and total results
Next steps
Search API
Explore all search options and advanced features
Highlighting
Learn how to highlight matched text in your UI