# rubyazz/search-engine- architecture

> Architecture diagram of the GitHub repository rubyazz/search-engine-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rubyazz/search-engine-
- Repository: https://github.com/rubyazz/search-engine-

## Overview

Seroost is a local folder search engine: `serve <folder>` loads or builds a persisted index while serving a browser UI and search/statistics API. The main indexing stages are file discovery and change detection, format-specific text extraction, tokenization/stemming, and index updates; queries are tokenized and ranked against that index. Source excerpts support these core links, but omit some `main.rs` details, so uncertain dispatch and extraction wiring is not expanded.

Main entry points: [`src/model.rs`](https://github.com/rubyazz/search-engine-/blob/master/src/model.rs) (Search model), [`src/server.rs`](https://github.com/rubyazz/search-engine-/blob/master/src/server.rs) (HTTP server), [`src/main.rs`](https://github.com/rubyazz/search-engine-/blob/master/src/main.rs) (CLI and indexer), [`src/snowball/algorithms/english_stemmer.rs`](https://github.com/rubyazz/search-engine-/blob/master/src/snowball/algorithms/english_stemmer.rs) (English stemmer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and indexing"]
  node_main["CLI and indexer<br/>[main.rs]"]
  node_extract["File extraction<br/>[main.rs]"]
  node_indexfile[("Persisted index")]
end

subgraph group_search["Search index"]
  node_model["Search model<br/>[model.rs]"]
  node_lexer["Tokenizer<br/>[lexer.rs]"]
  node_indexdata[("Term and document index<br/>[model.rs]")]
end

subgraph group_web["HTTP and browser"]
  node_server["HTTP server<br/>[server.rs]"]
  node_ui["Search UI<br/>[index.js]"]
  node_page["UI document<br/>[index.html]"]
end

subgraph group_stemming["English stemming"]
  node_stemmer["English stemmer<br/>[english_stemmer.rs]"]
  node_env["Stem environment<br/>[snowball_env.rs]"]
  node_among["Stem match tables<br/>[among.rs]"]
  node_snowball["Snowball exports<br/>[mod.rs]"]
end

node_user(("Folder user"))
node_browser(("Browser user"))
node_httpclient(("HTTP client"))

node_user -->|"starts serve"| node_main
node_main -->|"loads or saves"| node_indexfile
node_main -->|"extracts files"| node_extract
node_main -->|"updates index"| node_model
node_extract -->|"supplies text"| node_model
node_model -->|"tokenizes text"| node_lexer
node_lexer -->|"uses stemming"| node_snowball
node_snowball -->|"exports algorithm"| node_stemmer
node_stemmer -->|"edits word"| node_env
node_stemmer -->|"matches rules"| node_among
node_model -->|"stores terms"| node_indexdata
node_main -->|"starts server"| node_server
node_browser -->|"requests page or API"| node_server
node_server -->|"serves page"| node_page
node_server -->|"serves script"| node_ui
node_ui -->|"posts query"| node_httpclient
node_httpclient -->|"calls search API"| node_server
node_server -->|"searches or reads stats"| node_model
node_model -->|"tokenizes query"| node_lexer

click node_main "https://github.com/rubyazz/search-engine-/blob/master/src/main.rs"
click node_extract "https://github.com/rubyazz/search-engine-/blob/master/src/main.rs"
click node_server "https://github.com/rubyazz/search-engine-/blob/master/src/server.rs"
click node_ui "https://github.com/rubyazz/search-engine-/blob/master/src/index.js"
click node_page "https://github.com/rubyazz/search-engine-/blob/master/src/index.html"
click node_model "https://github.com/rubyazz/search-engine-/blob/master/src/model.rs"
click node_lexer "https://github.com/rubyazz/search-engine-/blob/master/src/lexer.rs"
click node_stemmer "https://github.com/rubyazz/search-engine-/blob/master/src/snowball/algorithms/english_stemmer.rs"
click node_env "https://github.com/rubyazz/search-engine-/blob/master/src/snowball/snowball_env.rs"
click node_among "https://github.com/rubyazz/search-engine-/blob/master/src/snowball/among.rs"
click node_snowball "https://github.com/rubyazz/search-engine-/blob/master/src/snowball/mod.rs"
click node_indexdata "https://github.com/rubyazz/search-engine-/blob/master/src/model.rs"

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_extract,node_indexfile,node_user,node_browser,node_httpclient toneBlue
class node_model,node_lexer,node_indexdata toneAmber
class node_server,node_ui,node_page toneMint
class node_stemmer,node_env,node_among,node_snowball toneRose
```

## Components

### Runtime and indexing

- [CLI and indexer](https://github.com/rubyazz/search-engine-/blob/master/src/main.rs): `src/main.rs`
- [File extraction](https://github.com/rubyazz/search-engine-/blob/master/src/main.rs): `src/main.rs`
- **Persisted index**

### Search index

- [Search model](https://github.com/rubyazz/search-engine-/blob/master/src/model.rs): `src/model.rs`
- [Tokenizer](https://github.com/rubyazz/search-engine-/blob/master/src/lexer.rs): `src/lexer.rs`
- [Term and document index](https://github.com/rubyazz/search-engine-/blob/master/src/model.rs): `src/model.rs`

### HTTP and browser

- [HTTP server](https://github.com/rubyazz/search-engine-/blob/master/src/server.rs): `src/server.rs`
- [Search UI](https://github.com/rubyazz/search-engine-/blob/master/src/index.js): `src/index.js`
- [UI document](https://github.com/rubyazz/search-engine-/blob/master/src/index.html): `src/index.html`

### English stemming

- [English stemmer](https://github.com/rubyazz/search-engine-/blob/master/src/snowball/algorithms/english_stemmer.rs): `src/snowball/algorithms/english_stemmer.rs`
- [Stem environment](https://github.com/rubyazz/search-engine-/blob/master/src/snowball/snowball_env.rs): `src/snowball/snowball_env.rs`
- [Stem match tables](https://github.com/rubyazz/search-engine-/blob/master/src/snowball/among.rs): `src/snowball/among.rs`
- [Snowball exports](https://github.com/rubyazz/search-engine-/blob/master/src/snowball/mod.rs): `src/snowball/mod.rs`

### Other components

- **Folder user**
- **Browser user**
- **HTTP client**

## Connections

- Folder user → CLI and indexer: starts serve
- CLI and indexer → Persisted index: loads or saves
- CLI and indexer → File extraction: extracts files
- CLI and indexer → Search model: updates index
- File extraction → Search model: supplies text
- Search model → Tokenizer: tokenizes text
- Tokenizer → Snowball exports: uses stemming
- Snowball exports → English stemmer: exports algorithm
- English stemmer → Stem environment: edits word
- English stemmer → Stem match tables: matches rules
- Search model → Term and document index: stores terms
- CLI and indexer → HTTP server: starts server
- Browser user → HTTP server: requests page or API
- HTTP server → UI document: serves page
- HTTP server → Search UI: serves script
- Search UI → HTTP client: posts query
- HTTP client → HTTP server: calls search API
- HTTP server → Search model: searches or reads stats
- Search model → Tokenizer: tokenizes query
