Al Islam features a custom, Lucene-inspired search engine built from the ground up using low-level languages and highly optimized for mobile devices. The search engine is completely independent from the app's database and was introduced in version 4.3. It supports both text-based searching and reference-based searching with intelligent filtering and fast retrieval, even on low-RAM devices.
Overview
The Search section is accessible from the bottom navigation bar. When you tap Search, you'll see a tabbed interface allowing you to switch between:
- New Search (default) — the custom optimized search engine with text and reference modes
- Old Search — the previous hierarchy-based reference search (still available)
You can swipe between tabs to switch modes.
Architecture
Why a Custom Search Engine?
Rather than relying on traditional database queries or existing search solutions, Al Islam features a completely custom search engine because:
- Full flexibility and control — complete ownership of the search implementation
- Mobile optimization — built from the ground up for phones, including low-RAM devices
- Performance — highly optimized for fast retrieval across millions of records
- Concurrency — handles multiple simultaneous searches efficiently
- Data integrity — never corrupts, even if interrupted during indexing
Lucene Inspiration
The search engine is inspired by Apache Lucene but completely custom-built and optimized for mobile. This means:
- Sophisticated ranking and relevance scoring
- Support for advanced query syntax
- Language-independent indexing
- Diacritic-insensitive matching (أَحْمَد, احمد, and Ahmad all match)
New Search Mode
The New Search is the primary search mode, combining text-based and reference-based searching with intelligent filtering.
The Interface
By default, all filters are pre-selected and intelligently configured. You don't need to adjust anything to start searching — just type. If you want to narrow your results, you can expand the filters section.
Search Methods
You can toggle between two search approaches, and at least one must always remain active:
1. Text Matching (Default)
Search by keywords and phrases across content:
- Hadith — text, narrator names, chains
- Quran — verses and translations
- Tafsir — interpretation text
- Collections — your saved item titles and descriptions
Examples:
mercy— finds instances across all translations and hadithdua protection— searches for content mentioning both words"night prayer"— exact phrase matching (enclose in quotes)
2. Reference Matching
Search by numeric references (Surah and Ayah numbers, Hadith book and chapter numbers, etc.)
Examples:
2:255— Ayat al-Kursi1, 3-5— Surah 1, Ayahs 3–540— References to number 40
The engine understands natural patterns, so these variations work:
Surah 2, Verse 255Ayah 255 from Surah 22-255(dash instead of colon)
Filters
Default Configuration
All filters are pre-selected by default with intelligent configuration. You can adjust them to narrow results.
Filter Types
Search Method
- Text Matching — keyword and phrase searching
- Reference Matching — numeric reference searching
At least one must remain active; both cannot be disabled simultaneously.
Sources
Choose which content categories to search:
- Hadith — 232,559 narrations across 33 collections
- Quran — 6,236 verses with 122 translations in 62 languages
- Tafsir — 95 scholarly interpretations
- Collections — your personal saved items
When you deselect a source, its related filters automatically hide.
Scopes (Text Matching Only)
Optional toggles for filtering:
- Surah — limit Quran results to specific surahs
- Parah/Juz — limit Quran results to specific paras
- Hadith Books — limit hadith results to specific books
When you select a scope, a dropdown appears. By default, all items are pre-selected.
Resource Filters (Text Matching Only)
- Language — search only in specific languages
- Resource Pack — search within specific translation or tafsir sets
All are pre-selected by default.
Reference-Specific Filters (Reference Matching Only)
When using Reference Matching, you can select:
- Source — Hadith or Quran
- Scope Chips — choose what references to interpret (Universal Book Order, Hadith Chapters, Surahs, Paras, Juz, Ruku in Surah, Ruku in Para, etc.)
- Hadith Books — specific hadith collections
- Sorting — order results by book, chapter, or other criteria
Each scope you select tells the engine to look for your reference in that classification. For example, selecting both "Surah" and "Juz" and entering 40 will find both Surah 40 and verses in the 40th Juz.
Dynamic adjustment: When you remove sources, their related scopes automatically disappear. Everything works dynamically without misconfiguration.
Reset Button
A reset button lets you return all filters to recommended defaults.
Query Syntax & Patterns
The search engine supports advanced query syntax for precise searching.
Basic Matching
mercy— matches "mercy," "merciful," and related wordsprayer time— matches content with both "prayer" and "time"
Exact Phrase Matching
Enclose text in double quotes:
"night prayer"— matches only this exact phrase"Surah Al-Fatiha"— exact title matching
Required & Optional Terms
Use + and - for control:
+apple juice— results must contain "apple"; "juice" is optional but boosts the scoreapple -fruit— matches "apple" but excludes results mentioning "fruit"
Wildcards
Use * for partial word matching:
mercy*— matches mercy, merciful, merciless*craft— matches craft, aircraft, witchcraft
Diacritic Insensitivity
The engine automatically normalizes diacritics:
Ahmad=Aḥmad=احمد=أحمدQuran=Qur'an=Qur'ān=القران=القرآن
Search Results
Result Presentation
Each result displays:
- Title/Reference — the content identifier
- Language — which translation or interpretation
- Source — Hadith, Quran, Tafsir, or Collection
- Resource — the specific book, pack, or collection
- Content Preview — a snippet with highlighted keywords
- Text Formatting — formatted according to your text customization preferences
Highlighting
Matched keywords are highlighted in the preview, showing why the result was returned.
Pagination & Performance
Results are paginated to ensure smooth scrolling and minimal RAM usage, even on low-end devices. The engine dynamically adjusts pagination based on available memory.
Navigation
Tap any result to navigate directly to that content in its native context:
- Tap a hadith → opens the Hadith section at that narration
- Tap a Quranic verse → opens the Quran section at that verse
- Tap a collection item → opens your Collections
Indexing & Data Integrity
How Indexing Works
Every time you download new data or update resources, the search index is built automatically. This process is:
- Transactional — if interrupted, the old index remains valid; nothing is corrupted
- Extremely fast — even 232,559 hadith are indexed quickly
- Progressive — you can start searching before indexing completes
Index Resilience
Even if the app crashes during indexing:
- Your existing index remains intact and searchable
- New data won't appear in search until indexing completes
- Nothing breaks; no manual recovery needed
Manual Re-indexing
If you suspect search results are missing:
- Tap the ⋮ (More) menu in the top-right of the Search screen
- Select Re-index Data
- A progress bar shows real-time indexing progress
- Once complete, all data is searchable again
This process is extremely fast.
Data Safety
All indexing operations are transactional:
- Operations complete fully or not at all
- The index is always in a valid state
- Concurrent operations don't interfere
- Data persists after completion
Performance
Speed
- Text search across 232,559 hadith: milliseconds
- Reference search: instant
- Result pagination: smooth, no stuttering
- Keyword highlighting: real-time
Memory Efficiency
- Dynamic RAM allocation — uses only what's needed, scales with device capability
- Pagination prevents exhaustion — low-RAM phones can search the entire corpus
- Parallel, concurrent processing — multiple operations don't accumulate memory overhead
Device Compatibility
Optimized across all device capabilities:
- Low-RAM devices (1–2GB) — full functionality with appropriate performance
- Mid-range phones (4–6GB) — snappy performance
- High-end devices (8GB+) — instant operations
Collections Search
Your personal Collections are fully searchable. The search engine indexes:
- Collection titles — folder names and item names
- Item descriptions — notes you've written
- Saved content — the actual hadith and verses you bookmarked
Old Search Mode
For structured, hierarchy-based reference searching, the Old Search remains available:
- Select source — Hadith or Quran
- Select scope — Hadith Chapters, Surahs, Paras, etc.
- Navigate the hierarchy — the UI shows relevant options
- Choose language — if multiple translations exist
- View results — with full context
This mode is excellent for explicit, step-by-step reference navigation but doesn't support text searching.
Switching Between Search Methods
When you switch between Text Matching and Reference Matching:
- Configuration is preserved — your previous settings for each method remain saved
- No configuration loss — switching back returns you to your exact previous state
- Sources adjust automatically — related filters update when you change methods
Tips & Best Practices
Effective Searching
- Start broad, then narrow — search all sources first, then add filters
- Use quotes for exact phrases —
"dua for protection"is more precise thandua protection - Combine syntax elements —
hadith +prayer -fajrfor specific queries - Trust the defaults — the default configuration covers most use cases
For Hadith Researchers
- Use
+narrator +chainto find specific transmission chains - Switch to Reference Matching if you know the hadith number
- Filter by specific Hadith Books to isolate scholarly sources
For Quranic Study
- Search in multiple languages simultaneously to compare translations
- Use Surah and Para scopes to focus on specific sections
- Combine text search with reference search — search for
mercyinSurah 2
For Collections
- Search your Collections to rediscover bookmarked content
- Use wildcards —
dua*finds dua, duas, duaa
Troubleshooting
"Results seem incomplete"
Cause: Index may be out of sync with latest data.
Fix:
- Open the ⋮ (More) menu in Search
- Tap Re-index Data
- Wait for the progress bar to complete
- Search again
"Search is slow"
Possible causes:
- Device is low on RAM
- Index rebuild is in progress
- Searching with very broad scope
Fix:
- Add filters to narrow scope
- Close other apps to free RAM
- Wait for indexing to complete
"A specific result doesn't appear"
Possible causes:
- Search syntax doesn't match the data format
- Source or scope is filtered out
Fixes:
- Try without diacritics — the engine normalizes them, but exact formatting matters
- Try wildcards —
prayer*instead ofprayers - Try exact phrases if searching book titles or proper names
- Verify the source and scopes are enabled
What's New in v4.3
The custom search engine was introduced in v4.3 as a complete reimplementation. Key improvements over previous search:
- Text search support — full keyword and phrase searching
- Speed — millisecond-level results across 232,559 hadith
- RAM optimization — dynamic allocation for low-end devices
- Concurrent searching — multiple queries simultaneously
- Query syntax — wildcards, required/optional terms, exact phrases
- Automatic diacritic normalization — you don't need to match diacritics exactly
The Old Search mode is preserved for users who prefer hierarchy-based navigation.