Description
Add support to save the current in-memory index to disk and reload it automatically when the engine starts. This avoids rebuilding the index every time the system restarts.
Why
- Currently, the index exists only in memory and is lost on terminating.
- Re-indexing on every startup is totaly inefficient, especially for large datasets.
What to Add
- A function to serialize and save the index to disk (e.g., using Go’s
encoding/gob).
- A function to load the index from disk on startup if exists.
- Automatically call load/save during startup/shutdown of the engine.
Example
// load/save index path
engine := engine.NewEngine(......, "index.gob")
err := engine.SaveIndex()
err := engine.LoadIndex()
Description
Add support to save the current in-memory index to disk and reload it automatically when the engine starts. This avoids rebuilding the index every time the system restarts.
Why
What to Add
encoding/gob).Example