Advanced Search and Exploration of Islamic Spiritual Teachings
- Overview
- Features
- Technology Stack
- Architecture
- Getting Started
- Usage Guide
- Project Structure
- Core Components
- Development Guide
- Deployment
- Contributing
- Roadmap
- Contact
Malfuzat Explorer is an advanced web application designed to facilitate comprehensive search and exploration of Malfuzat - the compilation of the sayings and discourses of Hazrat Mirza Ghulam Ahmad (AS), the Promised Messiah and founder of the Ahmadiyya Muslim Community.
This application serves multiple vital purposes:
- π Research Tool: Enables scholars, researchers, and students to efficiently search through extensive volumes of Malfuzat
- π Spiritual Growth: Provides easy access to Islamic teachings for personal development and understanding
- π Preservation: Helps preserve and disseminate important spiritual and religious literature
- π Advanced Discovery: Offers contextual search capabilities across multiple PDF volumes with intelligent text extraction
Malfuzat (Arabic: Ω ΩΩΩΩΩΩΨΈΩΨ§Ψͺ, literally "utterances" or "sayings") is a ten-volume collection documenting the discourses, teachings, and spiritual insights of Hazrat Mirza Ghulam Ahmad (AS). These volumes contain valuable religious guidance, interpretations of Islamic teachings, and spiritual wisdom delivered during various gatherings and conversations.
- π Full-Text PDF Search: Comprehensive search across 8 volumes of Malfuzat PDF documents (Volumes 1-4, 7-10)
- π― Contextual Results: Displays search results with surrounding context (up to 200 words) for better understanding
- π Page Reference: Identifies exact volume and page number ("leaf") where matches are found
- π Keyword Highlighting: Visual emphasis on search terms within results using yellow highlighting
- π Arabic & Urdu Text Rendering: Specialized font support using 'Noto Nastaliq Urdu' and 'Amiri' fonts
- π Right-to-Left (RTL) Display: Automatic detection and proper rendering of Arabic/Urdu text with RTL directionality
- π Special Language Styling: Arabic and Urdu text rendered in lime green with bold formatting for enhanced readability
- β‘ Loading Indicator: Visual preloader with animated GIF during page loads
- π± Responsive Design: Bootstrap-based responsive layout that works on desktop, tablet, and mobile devices
- π¨ Alternating Result Rows: Color-coded even/odd rows for improved result scanning
- β Input Validation: Client and server-side validation to ensure valid search queries
- β Error Handling: Graceful error messages when no results are found or errors occur
- π Async Processing: Asynchronous search operations for better performance
- π iText7 Integration: Professional PDF text extraction using iText7 library (v8.0.5)
- π Case-Insensitive Search: Intelligent search that matches regardless of letter casing
- π§© Regex-based Text Processing: Advanced text processing for accurate highlighting and language detection
| Technology | Version | Purpose |
|---|---|---|
| .NET | 8.0 | Core runtime framework |
| ASP.NET Core MVC | 8.0 | Web application framework with Model-View-Controller pattern |
| C# | 12.0 | Primary programming language |
| iText7 | 8.0.5 | PDF text extraction and processing |
| NEST | 7.17.5 | Elasticsearch .NET client (prepared for future enhancements) |
| Technology | Version | Purpose |
|---|---|---|
| Bootstrap | 5.x | Responsive UI framework |
| jQuery | 3.x | JavaScript library for DOM manipulation |
| jQuery Validation | 1.x | Client-side form validation |
| Custom CSS | - | Application-specific styling |
- Visual Studio 2022 - Primary IDE (Version 17.8+)
- Git - Version control
- GitHub Actions - CI/CD pipeline
- Azure Web Apps - Cloud hosting platform
The application follows the Model-View-Controller (MVC) architectural pattern:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Browser β
β (HTML/CSS/JavaScript + Bootstrap) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β HTTP Request/Response
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ASP.NET Core MVC β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Controllers Layer β β
β β (HomeController - Routes/Logic) β β
β ββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
β β Models Layer β β
β β (MalfuzatModel, ErrorViewModel) β β
β ββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
β ββββββββββββββββΌββββββββββββββββββββββββββββββββββββ β
β β Views Layer β β
β β (Razor CSHTML Templates) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PDF Processing Layer β
β (iText7 - PdfReader/PdfDocument) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Static PDF Files β
β (wwwroot/Malfuzat/*.pdf - 8 volumes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- User Input: User enters search query in the web interface
- Request Handling: HomeController receives POST request via Search action
- PDF Processing:
- Iterates through 8 PDF files in parallel
- Uses iText7 PdfReader to extract text from each page
- Performs case-insensitive text matching
- Context Extraction: Extracts 100 words before and after the match
- Text Enhancement:
- Highlights search terms with
<mark>tags - Detects Arabic/Urdu text using regex pattern matching Unicode ranges
- Wraps special language text in RTL spans
- Highlights search terms with
- Response: Returns formatted results to the view for display
Before running this application, ensure you have the following installed:
-
.NET 8.0 SDK or later (Download)
dotnet --version # Should show 8.0.x or higher -
Visual Studio 2022 (recommended) or Visual Studio Code with C# extension
- Visual Studio 2022 version 17.8+ recommended for best compatibility
-
Git for version control (Download)
-
Web Browser - Modern browser (Chrome, Firefox, Edge, Safari)
git clone https://github.com/intisor/MalfuzatExplorer.git
cd MalfuzatExplorerdotnet restoreThis will install the required dependencies:
- iText7 (8.0.5)
- NEST (7.17.5)
- ASP.NET Core framework packages
Ensure the Malfuzat PDF files are present in wwwroot/Malfuzat/:
- Malfuzat-1.pdf
- Malfuzat-2.pdf
- Malfuzat-3.pdf
- Malfuzat-4.pdf
- Malfuzat-7.pdf
- Malfuzat-8.pdf
- Malfuzat-9.pdf
- Malfuzat-10.pdf
Note: If PDF files are not included in the repository, you need to obtain them separately and place them in the wwwroot/Malfuzat/ directory.
The application uses standard ASP.NET Core configuration files:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}Used for development-specific settings. Logging levels can be adjusted here for debugging.
# Development mode with hot reload
dotnet run
# Or specify the project explicitly
dotnet run --project MalfuzatExplorer.csprojThe application will start and be accessible at:
- HTTP: http://localhost:5278
- HTTPS: https://localhost:7163
- Open
MalfuzatExplorer.slnin Visual Studio 2022 - Select the desired profile from the dropdown (http, https, or IIS Express)
- Press F5 to run with debugging, or Ctrl+F5 to run without debugging
dotnet run --launch-profile "IIS Express"# Build the project
dotnet build --configuration Release
# Publish the application
dotnet publish --configuration Release --output ./publishedThe published files will be in the ./published directory, ready for deployment.
- Navigate to the home page (default route:
/) - Enter your search query in the text input field
- Queries can be in English, Arabic, or Urdu
- Search is case-insensitive
- Click the "Search" button to execute the search
- View the results displayed below the search form
Each search result displays:
- Volume Identification: Shows which Malfuzat volume contains the match (e.g., "Found in Malfuzat-1")
- Page Number: Exact page (leaf) number where the text appears
- Context: Surrounding text (up to 100 words before and after) for context
- Highlighted Query: Your search term highlighted in yellow
- Language Formatting: Arabic/Urdu text displayed in green with RTL formatting
Example 1: English search
Query: "prayer"
Result: "Found in Malfuzat-1 on leaf 45: ...context around the word prayer..."
Example 2: Arabic/Urdu search
Query: "ΩΩ
Ψ§Ψ²"
Result: Multiple results showing Arabic/Urdu text in green RTL formatting
- Use specific terms: More specific queries yield more relevant results
- Try variations: Search for related terms if initial search yields no results
- Short queries: Single words or short phrases work best
- Language mixing: You can search for Arabic/Urdu terms even in English interface
MalfuzatExplorer/
βββ Controllers/
β βββ HomeController.cs # Main controller handling search logic
βββ Models/
β βββ MalfuzatModel.cs # Model for search query and results
β βββ ErrorViewModel.cs # Model for error handling
βββ Views/
β βββ Home/
β β βββ Index.cshtml # Main search interface
β β βββ Privacy.cshtml # Privacy policy page
β βββ Shared/
β β βββ _Layout.cshtml # Main layout template
β β βββ _Layout.cshtml.css # Layout-specific styles
β β βββ Error.cshtml # Error page
β β βββ _ValidationScriptsPartial.cshtml
β βββ _ViewImports.cshtml # Global view imports
β βββ _ViewStart.cshtml # View start configuration
βββ wwwroot/
β βββ Malfuzat/ # PDF files directory
β β βββ Malfuzat-1.pdf
β β βββ Malfuzat-2.pdf
β β βββ Malfuzat-3.pdf
β β βββ Malfuzat-4.pdf
β β βββ Malfuzat-7.pdf
β β βββ Malfuzat-8.pdf
β β βββ Malfuzat-9.pdf
β β βββ Malfuzat-10.pdf
β βββ css/
β β βββ site.css # Custom application styles
β βββ js/
β β βββ site.js # Custom JavaScript
β βββ lib/ # Client-side libraries
β β βββ bootstrap/ # Bootstrap framework
β β βββ jquery/ # jQuery library
β β βββ jquery-validation/ # jQuery validation
β βββ favicon.ico # Application icon
β βββ favico.ico
β βββ preloader.gif # Loading animation
βββ Properties/
β βββ launchSettings.json # Launch configuration profiles
βββ .github/
β βββ workflows/
β βββ MalfuzatExplorer.yml # CI/CD pipeline configuration
βββ Program.cs # Application entry point
βββ MalfuzatExplorer.csproj # Project file
βββ MalfuzatExplorer.sln # Solution file
βββ appsettings.json # Application configuration
βββ appsettings.Development.json # Development configuration
βββ .gitignore # Git ignore rules
βββ README.md # This file
public class MalfuzatModel
{
public string Query { get; set; } // User's search query
public List<string> Results { get; set; } // List of search results
public int PageNumber { get; set; } // For pagination (future use)
}public class ErrorViewModel
{
public string? RequestId { get; set; } // Request tracking ID
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}Key Methods:
-
Index() -
GET /- Displays the main search interface
- Initializes empty MalfuzatModel
-
Search(MalfuzatModel model) -
POST /Home/Search- Receives search query from form
- Validates input
- Calls SearchPdfForQueryAsync()
- Applies language formatting
- Returns results to view
-
SearchPdfForQueryAsync(string query)
- Iterates through 8 PDF files
- Opens each PDF using iText7 PdfReader
- Extracts text from every page
- Searches for query (case-insensitive)
- Collects matching results with context
- Returns formatted result list
-
GetContextAroundQueryAsync(string content, string query)
- Splits page content into words
- Finds query position
- Extracts 100 words before and after match
- Returns contextual snippet
-
HighlightQueryAsync(string text, string query)
- Uses regex to find query matches
- Wraps matches in
<mark>HTML tags - Returns highlighted text
-
SpecialLanguageAsync(string result, string query)
- Detects Arabic/Urdu characters (Unicode ranges U+0600-U+06FF, U+0750-U+077F, U+FB50-U+FDFF, U+FE70-U+FEFF)
- Wraps detected text in RTL spans with special styling
- Returns formatted result
- Main search interface
- Form with text input and search button
- Results display area with alternating row colors
- Embedded CSS for custom styling
- Special font support for Arabic/Urdu
- Master page layout
- Navigation bar
- Preloader animation
- Footer
- Includes Bootstrap, jQuery, and validation scripts
-
Clone and Restore
git clone https://github.com/intisor/MalfuzatExplorer.git cd MalfuzatExplorer dotnet restore -
Open in IDE
- Visual Studio: Open
MalfuzatExplorer.sln - VS Code: Open folder and install C# extension
- Visual Studio: Open
-
Run in Development Mode
dotnet run --environment Development
NuGet Packages:
<PackageReference Include="itext7" Version="8.0.5" />
<PackageReference Include="NEST" Version="7.17.5" />- Place PDF file in
wwwroot/Malfuzat/ - Update the
pdfFilesarray inHomeController.cs:private string[] pdfFiles = new string[] { // ... existing files ... Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "Malfuzat", "Malfuzat-11.pdf"), };
The search logic is centralized in SearchPdfForQueryAsync(). Key areas to modify:
- Search Algorithm: The query matching logic in
SearchPdfForQueryAsync() - Context Size: Adjust the word count parameters in
GetContextAroundQueryAsync()(currently 100 words before/after) - Highlighting: Modify the
HighlightQueryAsync()method for different highlight styles
# Build the project
dotnet build
# Run tests (if available)
dotnet test
# Clean build artifacts
dotnet clean- Follow C# coding conventions
- Use async/await for I/O operations
- Implement proper error handling with try-catch
- Add XML documentation comments for public methods
The project includes automated CI/CD via GitHub Actions.
The .github/workflows/MalfuzatExplorer.yml workflow automatically:
- Triggers on push to
masterbranch - Builds the project with .NET 8.0
- Runs tests
- Publishes artifacts
- Deploys to Azure Web App
# Publish the application
dotnet publish --configuration Release --output ./published
# Deploy to Azure (using Azure CLI)
az webapp up --name MalfuzatExplorer --resource-group YourResourceGroupEnvironment Variables:
ASPNETCORE_ENVIRONMENT: Set to "Production"DOTNET_CORE_VERSION: 8.0.x
Azure Web App Settings:
- Runtime: .NET 8
- Platform: Windows or Linux
- Always On: Enabled (recommended)
- Publish the application
- Configure IIS with .NET Core hosting bundle
- Create a new site pointing to published folder
- Configure application pool for "No Managed Code"
Create a Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["MalfuzatExplorer.csproj", "./"]
RUN dotnet restore
COPY . .
RUN dotnet build -c Release -o /app/build
FROM build AS publish
RUN dotnet publish -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MalfuzatExplorer.dll"]Build and run:
docker build -t malfuzatexplorer .
docker run -p 8080:80 malfuzatexplorerContributions are welcome and greatly appreciated! Here's how you can contribute to Malfuzat Explorer:
- π Report Bugs: Submit detailed bug reports via GitHub Issues
- π‘ Feature Requests: Suggest new features or enhancements
- π Documentation: Improve documentation, add examples, or fix typos
- π§ Code Contributions: Submit pull requests with bug fixes or new features
- π¬ Community Support: Help answer questions in Discussions
-
Fork the Repository
# Fork via GitHub UI, then clone your fork git clone https://github.com/YOUR-USERNAME/MalfuzatExplorer.git cd MalfuzatExplorer
-
Create a Feature Branch
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bugfix-name -
Make Your Changes
- Write clean, documented code
- Follow existing code style
- Add comments where necessary
- Test your changes thoroughly
-
Commit Your Changes
git add . git commit -m "feat: Add your descriptive commit message"
Commit Message Guidelines:
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting, etc.)refactor:Code refactoringtest:Adding testschore:Maintenance tasks
-
Push to Your Fork
git push origin feature/your-feature-name
-
Create a Pull Request
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your branch
- Provide a clear description of your changes
- Reference any related issues
- Code Quality: Ensure code is clean, readable, and well-documented
- Testing: Test all changes locally before submitting
- Dependencies: Minimize new dependencies; discuss major additions first
- Performance: Consider performance implications of changes
- Security: Never commit sensitive data or credentials
- Maintainers will review your PR
- Address any requested changes
- Once approved, your PR will be merged
- Your contribution will be recognized in release notes
- PDF Text Extraction: Implemented iText7 library for document processing
- Search Functionality: Core search logic with contextual results
- Multilingual Support: Arabic and Urdu text rendering with RTL support
- UI Design: Responsive Bootstrap-based interface
- Azure Deployment: CI/CD pipeline and cloud hosting
- Performance Optimization: Caching frequently accessed PDF content
- Advanced Search: Boolean operators (AND, OR, NOT) and phrase search
- Search History: Track and display recent searches
- Pagination: Display results across multiple pages
- Export Results: Download search results as PDF or text
- Bookmarking: Save favorite passages for later reference
- Improved UI/UX: Enhanced visual design and user experience
- Mobile Optimization: Better mobile-specific interface
- Elasticsearch Integration: Leverage NEST library for faster, more sophisticated searching
- Full-text Indexing: Pre-index all PDFs for instant search results
- Advanced Filtering: Filter by volume, date range, or topic
- Multi-language Interface: UI in multiple languages (English, Urdu, Arabic)
- User Accounts: Personal libraries and saved searches
- API Development: RESTful API for third-party integrations
- AI-Powered Features:
- Semantic search using natural language processing
- Topic modeling and automatic categorization
- Translation assistance
- Community Features:
- User annotations and notes
- Discussion forums
- Collaborative study groups
- Additional Content:
- Include other Islamic literature
- Cross-reference with related texts
- Audio/video content integration
- Mobile Apps: Native iOS and Android applications
We welcome suggestions for the roadmap! Please share your ideas in GitHub Discussions.
Developer: Abdul Awwal Intisor
- Email: [email protected]
- LinkedIn: linkedin.com/in/intitech07
- GitHub: @intisor
Project Repository: https://github.com/intisor/MalfuzatExplorer
Issues & Bug Reports: GitHub Issues
Feature Requests: GitHub Discussions
This project is open-source and available for use in accordance with standard open-source practices. Please refer to the repository for specific license details.
- Ahmadiyya Muslim Community: For the compilation and preservation of Malfuzat
- iText7 Team: For the excellent PDF processing library
- ASP.NET Core Team: For the robust web framework
- Bootstrap Team: For the responsive UI framework
- All Contributors: Thank you to everyone who contributes to this project
- ASP.NET Core Documentation: https://learn.microsoft.com/aspnet/core
- iText7 Documentation: https://itextpdf.com/products/itext-7
- Bootstrap Documentation: https://getbootstrap.com/docs
- Ahmadiyya Muslim Community: https://www.alislam.org
Built with β€οΈ for the exploration and preservation of Islamic spiritual knowledge
Contributor graph will be populated as contributions are made to the project
May this tool benefit all seekers of knowledge and spiritual growth
Last Updated: December 2024