a93a843506
- internal/index/manticore.go: ManticoreTenantManager + manticoreIndex (RT-Indizes, CGO-frei) - internal/index/index.go: TenantIndexer Interface (Xapian + Manticore) - internal/index/tenant_worker.go: mgr-Typ auf TenantIndexer Interface - internal/api/server.go: idxMgr auf TenantIndexer Interface - config/config.go: IndexConfig.ManticoreDSN Feld - cmd/archivmail/cmd_reindex.go: reindex Subkommando - cmd/archivmail/main.go: Manticore-Branch + reindex Case - go.mod: github.com/go-sql-driver/mysql v1.8.1 - update.sh: Manticore auto-install, CGO_ENABLED=0, config.yml migration, auto-reindex fix(IMAP): TCP-Deadline-Wrapper für steckengebliebene Imports fix(auth): Email-Claim in JWT für User-Isolation fix(search): User-Isolation via sess.Email (fail-safe) fix(ui): Admin-Login Auth-Cache, Logout-Redirect, IMAP-Polling-Resilienz Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
74 lines
1.8 KiB
Go
74 lines
1.8 KiB
Go
package index
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// MailDocument is the indexed representation of a stored email.
|
|
type MailDocument struct {
|
|
ID string
|
|
From string
|
|
To string
|
|
Subject string
|
|
Body string
|
|
AttachNames string
|
|
HasAttachment bool
|
|
Date time.Time
|
|
Size int64
|
|
TenantID *int64 // nil = global / superadmin context
|
|
}
|
|
|
|
// SearchRequest specifies search parameters.
|
|
type SearchRequest struct {
|
|
Query string
|
|
From string
|
|
To string
|
|
OwnEmail string
|
|
DateFrom *time.Time
|
|
DateTo *time.Time
|
|
HasAttachment *bool // nil=no filter, true=only with, false=only without
|
|
LabelID *int64 `json:"label_id,omitempty"` // PROJ-9: post-filter by label
|
|
Sort string // "relevance", "date_asc", "date_desc" (default: date_desc)
|
|
PageSize int
|
|
Page int
|
|
}
|
|
|
|
// Hit is a single search result.
|
|
type Hit struct {
|
|
ID string `json:"id"`
|
|
Score float64 `json:"score"`
|
|
}
|
|
|
|
// SearchResult holds paginated search results.
|
|
type SearchResult struct {
|
|
Total int
|
|
Hits []Hit
|
|
}
|
|
|
|
// Indexer is the interface for full-text email indexing.
|
|
type Indexer interface {
|
|
IndexSync(doc MailDocument) error
|
|
Search(req SearchRequest) (*SearchResult, error)
|
|
Delete(id string) error
|
|
Close() error
|
|
}
|
|
|
|
// TenantIndexer manages per-tenant Indexer instances.
|
|
// Implemented by TenantIndexManager (Xapian) and ManticoreTenantManager.
|
|
type TenantIndexer interface {
|
|
ForTenant(tenantID *int64) Indexer
|
|
Global() Indexer
|
|
Close() error
|
|
}
|
|
|
|
// New creates an Indexer for the specified backend.
|
|
func New(dir string, batchSize int, backend string) (Indexer, error) {
|
|
switch backend {
|
|
case "xapian":
|
|
return newXapian(dir)
|
|
default:
|
|
return nil, fmt.Errorf("unknown index backend: %q (supported: xapian)", backend)
|
|
}
|
|
}
|