How jith1/inverted-search-index-database-in-c works
This is a command-line inverted-index program. Users supply text files at startup, build an in-memory word-to-file index, then display, save, search, update, or clear it. Search loads a previously saved index before querying it; update indexes an additional file. The graph follows calls shown in the excerpts and references recorded in the source index; unsampled behavior and unshown connections are omitted.
Main entry points: main.c Menu controller · inverted.h Index structures · Update.c Index update · Search.c Search workflow
Components 14
CLI workflow
- Menu controller
main.c - Argument validation
function.c - Index display
Display.c
Indexing and state
- Index builder
Database.c - Index update
Update.c - Index structures
inverted.h - API declarations
function.h - Clear index
Clear.c
Saved index operations
- Save index
Save.c - Search workflow
Search.c - Index loader
Search.c
Other components
- User
- Input text files
- Saved index file
Connections 24
- User → Menu controller: chooses operations
main.c - Menu controller → Argument validation: validates arguments
main.c - Argument validation → Input text files: opens and validates
function.c - Menu controller → Index builder: builds index
main.c - Index builder → Input text files: reads words
Database.c - Index builder → Index structures: populates
Database.c - Menu controller → Index display: displays index
main.c - Index display → Index structures: reads entries
Display.c - Menu controller → Save index: saves index
main.c - Save index → Index structures: reads entries
Save.c - Save index → Saved index file: writes database
Save.c - Menu controller → Search workflow: starts search
main.c - Search workflow → Saved index file: opens database
Search.c - Search workflow → Index loader: loads database
Search.c - Index loader → Index structures: reconstructs entries
Search.c - Search workflow → Clear index: clears temporary index
Search.c - Menu controller → Index update: updates index
main.c - Index update → Input text files: reads selected file
Update.c - Index update → Index builder: stores words
Update.c - Index update → Index structures: updates entries
Update.c - Menu controller → Clear index: clears index
main.c - Clear index → Index structures: frees entries
Clear.c - Menu controller → API declarations: uses declarations
main.c - API declarations → Index structures: includes structures
function.h