# jith1/inverted-search-index-database-in-c architecture

> Architecture diagram of the GitHub repository jith1/inverted-search-index-database-in-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jith1/inverted-search-index-database-in-c
- Repository: https://github.com/jith1/inverted-search-index-database-in-c

## Overview

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`](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/main.c) (Menu controller), [`inverted.h`](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/inverted.h) (Index structures), [`Update.c`](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Update.c) (Index update), [`Search.c`](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Search.c) (Search workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["Menu controller<br/>[main.c]"]
  node_argument_validation["Argument validation<br/>[function.c]"]
  node_display["Index display<br/>[Display.c]"]
end

subgraph group_indexing["Indexing and state"]
  node_index_builder["Index builder<br/>[Database.c]"]
  node_index_update["Index update<br/>[Update.c]"]
  node_index_state["Index structures<br/>[inverted.h]"]
  node_api_declarations["API declarations<br/>[function.h]"]
  node_clear["Clear index<br/>[Clear.c]"]
end

subgraph group_database["Saved index operations"]
  node_save["Save index<br/>[Save.c]"]
  node_search["Search workflow<br/>[Search.c]"]
  node_index_loader["Index loader<br/>[Search.c]"]
end

node_user(("User"))
node_input_files["Input text files"]
node_saved_index["Saved index file"]

node_user -->|"chooses operations"| node_main
node_main -->|"validates arguments"| node_argument_validation
node_argument_validation -->|"opens and validates"| node_input_files
node_main -->|"builds index"| node_index_builder
node_index_builder -->|"reads words"| node_input_files
node_index_builder -->|"populates"| node_index_state
node_main -->|"displays index"| node_display
node_display -->|"reads entries"| node_index_state
node_main -->|"saves index"| node_save
node_save -->|"reads entries"| node_index_state
node_save -->|"writes database"| node_saved_index
node_main -->|"starts search"| node_search
node_search -->|"opens database"| node_saved_index
node_search -->|"loads database"| node_index_loader
node_index_loader -->|"reconstructs entries"| node_index_state
node_search -->|"clears temporary index"| node_clear
node_main -->|"updates index"| node_index_update
node_index_update -->|"reads selected file"| node_input_files
node_index_update -->|"stores words"| node_index_builder
node_index_update -->|"updates entries"| node_index_state
node_main -->|"clears index"| node_clear
node_clear -->|"frees entries"| node_index_state
node_main -->|"uses declarations"| node_api_declarations
node_api_declarations -->|"includes structures"| node_index_state

click node_main "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/main.c"
click node_argument_validation "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/function.c"
click node_index_builder "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Database.c"
click node_index_update "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Update.c"
click node_index_state "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/inverted.h"
click node_api_declarations "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/function.h"
click node_display "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Display.c"
click node_save "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Save.c"
click node_search "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Search.c"
click node_index_loader "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Search.c"
click node_clear "https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Clear.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_argument_validation,node_display,node_user toneBlue
class node_index_builder,node_index_update,node_index_state,node_api_declarations,node_clear toneAmber
class node_save,node_search,node_index_loader toneMint
class node_input_files,node_saved_index toneIndigo
```

## Components

### CLI workflow

- [Menu controller](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/main.c): `main.c`
- [Argument validation](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/function.c): `function.c`
- [Index display](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Display.c): `Display.c`

### Indexing and state

- [Index builder](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Database.c): `Database.c`
- [Index update](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Update.c): `Update.c`
- [Index structures](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/inverted.h): `inverted.h`
- [API declarations](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/function.h): `function.h`
- [Clear index](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Clear.c): `Clear.c`

### Saved index operations

- [Save index](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Save.c): `Save.c`
- [Search workflow](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Search.c): `Search.c`
- [Index loader](https://github.com/jith1/inverted-search-index-database-in-c/blob/main/Search.c): `Search.c`

### Other components

- **User**
- **Input text files**
- **Saved index file**

## Connections

- User → Menu controller: chooses operations (evidence: `main.c`)
- Menu controller → Argument validation: validates arguments (evidence: `main.c`)
- Argument validation → Input text files: opens and validates (evidence: `function.c`)
- Menu controller → Index builder: builds index (evidence: `main.c`)
- Index builder → Input text files: reads words (evidence: `Database.c`)
- Index builder → Index structures: populates (evidence: `Database.c`)
- Menu controller → Index display: displays index (evidence: `main.c`)
- Index display → Index structures: reads entries (evidence: `Display.c`)
- Menu controller → Save index: saves index (evidence: `main.c`)
- Save index → Index structures: reads entries (evidence: `Save.c`)
- Save index → Saved index file: writes database (evidence: `Save.c`)
- Menu controller → Search workflow: starts search (evidence: `main.c`)
- Search workflow → Saved index file: opens database (evidence: `Search.c`)
- Search workflow → Index loader: loads database (evidence: `Search.c`)
- Index loader → Index structures: reconstructs entries (evidence: `Search.c`)
- Search workflow → Clear index: clears temporary index (evidence: `Search.c`)
- Menu controller → Index update: updates index (evidence: `main.c`)
- Index update → Input text files: reads selected file (evidence: `Update.c`)
- Index update → Index builder: stores words (evidence: `Update.c`)
- Index update → Index structures: updates entries (evidence: `Update.c`)
- Menu controller → Clear index: clears index (evidence: `main.c`)
- Clear index → Index structures: frees entries (evidence: `Clear.c`)
- Menu controller → API declarations: uses declarations (evidence: `main.c`)
- API declarations → Index structures: includes structures (evidence: `function.h`)
