Open source implementation of Mattermost Enterprise features: Authentication & SSO: - LDAP authentication and sync - LDAP diagnostics - SAML 2.0 SSO - OAuth providers (Google, Office365, OpenID Connect) Infrastructure: - Redis-based cluster implementation - Prometheus metrics - IP filtering - Push proxy authentication Search: - Bleve search engine (lightweight Elasticsearch alternative) Compliance & Security: - Compliance reporting - Data retention policies - Message export (Actiance, GlobalRelay, CSV) - Access control (PAP/PDP) User Management: - Account migration (LDAP/SAML) - ID-loaded push notifications - Outgoing OAuth connections 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
88 lines
3.8 KiB
Go
88 lines
3.8 KiB
Go
// Copyright (c) 2024 Mattermost Community Enterprise
|
|
// Registration of Bleve Search Engine implementation
|
|
|
|
package searchengine
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
|
"github.com/mattermost/mattermost/server/public/shared/request"
|
|
)
|
|
|
|
// SearchEngineInterface defines the interface for search engines
|
|
// This mirrors the interface from platform/services/searchengine
|
|
type SearchEngineInterface interface {
|
|
Start() *model.AppError
|
|
Stop() *model.AppError
|
|
GetFullVersion() string
|
|
GetVersion() int
|
|
GetPlugins() []string
|
|
UpdateConfig(cfg *model.Config)
|
|
GetName() string
|
|
IsEnabled() bool
|
|
IsActive() bool
|
|
IsIndexingEnabled() bool
|
|
IsSearchEnabled() bool
|
|
IsAutocompletionEnabled() bool
|
|
IsIndexingSync() bool
|
|
IndexPost(post *model.Post, teamId string) *model.AppError
|
|
SearchPosts(channels model.ChannelList, searchParams []*model.SearchParams, page, perPage int) ([]string, model.PostSearchMatches, *model.AppError)
|
|
DeletePost(post *model.Post) *model.AppError
|
|
DeleteChannelPosts(rctx request.CTX, channelID string) *model.AppError
|
|
DeleteUserPosts(rctx request.CTX, userID string) *model.AppError
|
|
IndexChannel(rctx request.CTX, channel *model.Channel, userIDs, teamMemberIDs []string) *model.AppError
|
|
SyncBulkIndexChannels(rctx request.CTX, channels []*model.Channel, getUserIDsForChannel func(channel *model.Channel) ([]string, error), teamMemberIDs []string) *model.AppError
|
|
SearchChannels(teamId, userID, term string, isGuest, includeDeleted bool) ([]string, *model.AppError)
|
|
DeleteChannel(channel *model.Channel) *model.AppError
|
|
IndexUser(rctx request.CTX, user *model.User, teamsIds, channelsIds []string) *model.AppError
|
|
SearchUsersInChannel(teamId, channelId string, restrictedToChannels []string, term string, options *model.UserSearchOptions) ([]string, []string, *model.AppError)
|
|
SearchUsersInTeam(teamId string, restrictedToChannels []string, term string, options *model.UserSearchOptions) ([]string, *model.AppError)
|
|
DeleteUser(user *model.User) *model.AppError
|
|
IndexFile(file *model.FileInfo, channelId string) *model.AppError
|
|
SearchFiles(channels model.ChannelList, searchParams []*model.SearchParams, page, perPage int) ([]string, *model.AppError)
|
|
DeleteFile(fileID string) *model.AppError
|
|
DeletePostFiles(rctx request.CTX, postID string) *model.AppError
|
|
DeleteUserFiles(rctx request.CTX, userID string) *model.AppError
|
|
DeleteFilesBatch(rctx request.CTX, endTime, limit int64) *model.AppError
|
|
TestConfig(rctx request.CTX, cfg *model.Config) *model.AppError
|
|
PurgeIndexes(rctx request.CTX) *model.AppError
|
|
PurgeIndexList(rctx request.CTX, indexes []string) *model.AppError
|
|
RefreshIndexes(rctx request.CTX) *model.AppError
|
|
DataRetentionDeleteIndexes(rctx request.CTX, cutoff time.Time) *model.AppError
|
|
}
|
|
|
|
// BleveEngineFactory is a function type that creates a SearchEngineInterface
|
|
type BleveEngineFactory func(config func() *model.Config, logger mlog.LoggerIFace) SearchEngineInterface
|
|
|
|
// NewBleveEngineFactory returns a factory function for creating Bleve search engines
|
|
func NewBleveEngineFactory() BleveEngineFactory {
|
|
return func(config func() *model.Config, logger mlog.LoggerIFace) SearchEngineInterface {
|
|
cfg := &BleveConfig{
|
|
Config: config,
|
|
Logger: logger,
|
|
}
|
|
return NewBleveEngine(cfg)
|
|
}
|
|
}
|
|
|
|
// CreateBleveEngine creates a new Bleve search engine directly
|
|
func CreateBleveEngine(config func() *model.Config, logger mlog.LoggerIFace) SearchEngineInterface {
|
|
cfg := &BleveConfig{
|
|
Config: config,
|
|
Logger: logger,
|
|
}
|
|
return NewBleveEngine(cfg)
|
|
}
|
|
|
|
// CreateBleveEngineWithSettings creates a Bleve engine with custom settings
|
|
func CreateBleveEngineWithSettings(config func() *model.Config, logger mlog.LoggerIFace, settings *BleveSettings) SearchEngineInterface {
|
|
engine := &BleveEngine{
|
|
config: config,
|
|
logger: logger,
|
|
settings: settings,
|
|
}
|
|
return engine
|
|
}
|