CoolFace
Apppublic

executor1389/modern-search-engine

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
App README

Dejan Petrovic Search Engine

A modular web search engine prototype featuring a multi-stage retrieval and ranking pipeline. <img width="1909" height="919" alt="Web Search App" src="https://github.com/user-attachments/assets/f1cbffca-5d59-4a26-87fb-c72ae74becd3" />

๐Ÿš€ Features

  • โ€”Multi-lingual Architecture: Python-based search core with a lightning-fast FastAPI backend.
  • โ€”Hybrid Retrieval: Combines keyword-based (BM25) and similarity-based (TF-IDF) retrieval for improved recall and precision.
  • โ€”Multi-stage Ranking: A sophisticated ranker that extracts features like title matching and document metrics to refine final results.
  • โ€”Modern UI: A premium, dark-mode search interface built with glassmorphism aesthetics.
  • โ€”Performance Optimized: Total search latency under 50ms.

๐Ÿ› ๏ธ Tech Stack

  • โ€”Backend: Python 3.11, FastAPI, Uvicorn
  • โ€”Search Core: Whoosh (BM25), Scikit-Learn (TF-IDF)
  • โ€”NLP: NLTK (Stemming & Tokenization)
  • โ€”Frontend: Vanilla HTML5, CSS3, ES6+ Javascript

๐Ÿ“‚ Project Structure

  • โ€”crawler.py: Crawls and parses HTML documents into JSON.
  • โ€”indexer.py: Builds the inverted and vector indexes.
  • โ€”retrieval.py: Implements hybrid search and Reciprocal Rank Fusion (RRF).
  • โ€”ranker.py: Performs feature extraction and final document scoring.
  • โ€”app.py: FastAPI server serving the API and UI.
  • โ€”index.html: Modern search frontend.

๐Ÿ Getting Started

1. Requirements

  • โ€”Python 3.11+
  • โ€”PowerShell (for script execution setup)

2. Installation

powershell
# Create and activate virtual environment
python -m venv venv
.\venv\Scripts\Activate.ps1

# Install dependencies
pip install requests beautifulsoup4 whoosh scikit-learn numpy fastapi uvicorn nltk

3. Usage

powershell
# Step 1: Initialize data (Optional - pre-crawled data exists)
python crawler.py

# Step 2: Build the search index
python indexer.py

# Step 3: Start the search engine
python app.py

Open your browser to http://localhost:8000.

๐Ÿ“ˆ Performance Summary

  • โ€”Retrieval: < 50ms
  • โ€”Ranking: < 1ms
  • โ€”Total Latency: ~50ms
  • โ€”Memory Footprint: Lightweight (optimized for local prototypes)