How erenoozr/searchcraft works
SearchCraft is an in-memory Python search engine. A user submits a query through the CLI or library API; the engine parses it, evaluates Boolean and phrase logic against the positional index, scores matches with BM25, and returns ranked results with snippets. Document ingestion uses the same text pipeline to populate the index. The README documents the demo dataset and capabilities; some CLI and result-construction details fall in omitted source excerpts, so those links are not asserted as verified calls.
Main entry points: searchcraft.py SearchEngine · dataset.py Demo documents
Components 11
Text and Index
- Demo documents
dataset.py - Text pipeline
searchcraft.py - Positional index
searchcraft.py
Query and Ranking
- Query parser
searchcraft.py - Boolean AST
searchcraft.py - BM25 scorer
searchcraft.py
Search Interface
- CLI shell
searchcraft.py - SearchEngine
searchcraft.py - Ranked results
searchcraft.py - Match snippets
searchcraft.py
Other components
- Search user
Connections 17
- Search user → CLI shell: runs query
README.md - Search user → SearchEngine: calls API
README.md - CLI shell → SearchEngine: submits query
searchcraft.py - SearchEngine → Positional index: creates
searchcraft.py - SearchEngine → BM25 scorer: creates
searchcraft.py - SearchEngine → Query parser: creates
searchcraft.py - SearchEngine → Positional index: adds documents
searchcraft.py - Positional index → Text pipeline: analyzes text
searchcraft.py - SearchEngine → Query parser: parses query
searchcraft.py - Query parser → Text pipeline: analyzes terms
searchcraft.py - SearchEngine → Boolean AST: evaluates query
searchcraft.py - Boolean AST → BM25 scorer: scores matches
searchcraft.py - BM25 scorer → Positional index: reads postings
searchcraft.py - SearchEngine → Ranked results: ranks matches
searchcraft.py - SearchEngine → Match snippets: builds snippets
searchcraft.py - Positional index → Match snippets: reads document spans
searchcraft.py - CLI shell → Demo documents: loads demo corpus
searchcraft.py