diff options
| author | alex <[email protected]> | 2026-07-28 20:01:28 +0200 |
|---|---|---|
| committer | alex <[email protected]> | 2026-07-28 20:01:28 +0200 |
| commit | 95ccea8d0244e515947c335ace620838f01be60a (patch) | |
| tree | 1bce68640f72ba4c010f2abecc89d3e61460ab29 /core/engine.go | |
| parent | c91c3afd8700138f8eb8a25a4ae422c2c9e46cea (diff) | |
| download | search-engine-95ccea8d0244e515947c335ace620838f01be60a.tar.xz search-engine-95ccea8d0244e515947c335ace620838f01be60a.zip | |
forgor :skull:
Diffstat (limited to 'core/engine.go')
| -rw-r--r-- | core/engine.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/engine.go b/core/engine.go index 4b6b150..6e929e2 100644 --- a/core/engine.go +++ b/core/engine.go @@ -19,6 +19,11 @@ func NewEngine() *Engine { } } +func NewEngineWithIndex(idx *index.InvertedIndex) *Engine { + return &Engine{ + idx: idx, + } +} func (e *Engine) Index() *index.InvertedIndex { return e.idx } @@ -39,8 +44,13 @@ func (e *Engine) IndexDump(filePath string, numWorkers int) error { } }) } - - err := ingest.IngestWikiDump(filePath, jobQueue) + var processedCount int + err := ingest.WikiDump(filePath, jobQueue, func() { + processedCount++ + if processedCount%1000 == 0 { + fmt.Printf("\rProcessed %d articles...", processedCount) + } + }) close(jobQueue) wg.Wait() |
