fix: Manticore als Standard-Backend, Xapian-Cleanup in update.sh
- main.go: Default-Backend von "xapian" auf "manticore" geändert - index.go: Kommentar und Fehlermeldung aktualisiert - update.sh: Xapian-Verzeichnis wird nach erfolgreichem Manticore-Reindex automatisch entfernt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -121,7 +121,7 @@ func main() {
|
|||||||
// Index — per-tenant index manager (PROJ-21 Phase 4)
|
// Index — per-tenant index manager (PROJ-21 Phase 4)
|
||||||
indexBackend := cfg.Index.Backend
|
indexBackend := cfg.Index.Backend
|
||||||
if indexBackend == "" {
|
if indexBackend == "" {
|
||||||
indexBackend = "xapian"
|
indexBackend = "manticore"
|
||||||
}
|
}
|
||||||
batchSize := cfg.Index.BatchSize
|
batchSize := cfg.Index.BatchSize
|
||||||
if batchSize <= 0 {
|
if batchSize <= 0 {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ type Indexer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TenantIndexer manages per-tenant Indexer instances.
|
// TenantIndexer manages per-tenant Indexer instances.
|
||||||
// Implemented by TenantIndexManager (Xapian) and ManticoreTenantManager.
|
// Implemented by ManticoreTenantManager (primary) and TenantIndexManager (legacy Xapian).
|
||||||
type TenantIndexer interface {
|
type TenantIndexer interface {
|
||||||
ForTenant(tenantID *int64) Indexer
|
ForTenant(tenantID *int64) Indexer
|
||||||
Global() Indexer
|
Global() Indexer
|
||||||
@@ -63,11 +63,12 @@ type TenantIndexer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New creates an Indexer for the specified backend.
|
// New creates an Indexer for the specified backend.
|
||||||
|
// Deprecated: use NewManticoreTenantManager instead.
|
||||||
func New(dir string, batchSize int, backend string) (Indexer, error) {
|
func New(dir string, batchSize int, backend string) (Indexer, error) {
|
||||||
switch backend {
|
switch backend {
|
||||||
case "xapian":
|
case "xapian":
|
||||||
return newXapian(dir)
|
return newXapian(dir)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unknown index backend: %q (supported: xapian)", backend)
|
return nil, fmt.Errorf("unknown index backend: %q (use manticore via NewManticoreTenantManager)", backend)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,12 @@ if grep -q 'backend: manticore' /etc/archivmail/config.yml 2>/dev/null \
|
|||||||
info "Baue Manticore-Suchindex auf (alle Mails)..."
|
info "Baue Manticore-Suchindex auf (alle Mails)..."
|
||||||
if timeout 600 /opt/archivmail/bin/archivmail reindex --config /etc/archivmail/config.yml; then
|
if timeout 600 /opt/archivmail/bin/archivmail reindex --config /etc/archivmail/config.yml; then
|
||||||
log "Manticore-Index aufgebaut"
|
log "Manticore-Index aufgebaut"
|
||||||
|
# Xapian-Altdaten entfernen (nach erfolgreichem Manticore-Reindex)
|
||||||
|
XAPIAN_DIR="/var/archivmail/xapian"
|
||||||
|
if [[ -d "$XAPIAN_DIR" ]]; then
|
||||||
|
rm -rf "$XAPIAN_DIR"
|
||||||
|
log "Xapian-Altdaten entfernt ($XAPIAN_DIR)"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warn "Reindex nicht abgeschlossen — bei Bedarf manuell: archivmail reindex"
|
warn "Reindex nicht abgeschlossen — bei Bedarf manuell: archivmail reindex"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user