This project stores uploaded text snippets in SQLite and builds in-memory retrievers from that data.
Implemented from scratch (using only NumPy for vector math):
- TF-IDF retriever
- BM25 retriever
- Keyword overlap retriever
Create a project-local .env.local file in the repository root:
SQLITE_DB_PATH=app/data/snippets.sqlite3The app reads SQLite settings from .env.local by default.
/Users/suyogdevkhanal/Projects/mini_search_with_IR_algos/.venv/bin/python main.pyFrontend app lives in frontend/.
cd frontend
npm install
npm run devBy default, frontend calls backend at http://localhost:8000 using:
# frontend/.env.local
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000POST /upload
{
"text": "Your text snippet here",
"doc_id": "optional-custom-id",
"source": "upload",
"query": "optional query for immediate similarity",
"top_k": 5
}Response includes immediate similarity results from TF-IDF, BM25, and keyword retrievers.
POST /search/tfidf
POST /search/bm25
POST /search/keyword
{
"query": "normalize structure",
"top_k": 5
}POST /reload