From 8ed125de2d88361dee624c00fb3bb4d241e2579a Mon Sep 17 00:00:00 2001 From: MickaelK Date: Wed, 11 Mar 2026 14:17:53 +1100 Subject: [PATCH] fix (plg_search_sqlitefts): improve discovery phase --- .../plg_search_sqlitefts/crawler/phase_explore.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/plugin/plg_search_sqlitefts/crawler/phase_explore.go b/server/plugin/plg_search_sqlitefts/crawler/phase_explore.go index e2dba932..718f4151 100644 --- a/server/plugin/plg_search_sqlitefts/crawler/phase_explore.go +++ b/server/plugin/plg_search_sqlitefts/crawler/phase_explore.go @@ -35,10 +35,12 @@ func (this *Crawler) DiscoverPop() *Document { } func (this *Crawler) DiscoverPush(doc *Document, files []os.FileInfo, tx indexer.Manager) bool { + existing := make(map[string]bool, len(files)) excluded := SEARCH_EXCLUSION() for i := range files { f := files[i] name := f.Name() + existing[name] = true skip := false for i := 0; i < len(excluded); i++ { if name == excluded[i] || strings.Contains(doc.Path, excluded[i]) { @@ -87,5 +89,15 @@ func (this *Crawler) DiscoverPush(doc *Document, files []os.FileInfo, tx indexer } } } + if rows, err := tx.FindParent(doc.Path); err == nil { + for rows.Next() { + if r, err := rows.Value(); err == nil { + if !existing[r.Name] { + tx.RemoveAll(r.Path) + } + } + } + rows.Close() + } return true }