search() function accepts any dataset shape as long as each record satisfies the VerseInput type. This allows you to use custom Quran datasets with additional fields like translations, tafsir, or metadata.
VerseInput requirements
Fromsrc/types/index.ts:16-20:
Minimum requirements
gid: number- Unique verse ID (used to join withmorphologyMap)standard: string- Used for exact text matchinguthmani: string- Used for fuzzy fallback and commonly used for highlighting in UI
If you don’t have separate Uthmani text, set
uthmani to the same value as standard.Basic custom dataset
Here’s a minimal example with custom fields:Full example from README
From the README (lines 302-332):With morphology data
For lemma/root matching, provide both morphology map and word map:MorphologyAya structure
Fromsrc/types/index.ts:22-26:
WordMap structure
Fromsrc/types/index.ts:28-33:
Complete example
TypeScript support
Thesearch() function is generic and preserves your custom type:
src/core/search.ts:303-310:
Multiple translations
You can include multiple translations in your custom dataset:GID mapping
Thegid (global ID) must be:
- Unique for each verse
- Consistent between your verse data and morphology data
- A positive integer
Empty morphology
If you don’t have morphology data, you can use empty collections:Without morphology data, the search will only perform exact text matching and fuzzy fallback (if enabled).