indexer

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobStatusRunning   = "running"
	JobStatusCompleted = "completed"
	JobStatusFailed    = "failed"
	JobStatusCanceled  = "canceled"

	// KV store keys
	ReindexJobKey = "reindex_job_status"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Indexer

type Indexer struct {
	// contains filtered or unexported fields
}

func New

func New(
	search embeddings.EmbeddingSearch,
	pluginAPI mmapi.Client,
	bots *bots.MMBots,
	db *sqlx.DB,
) *Indexer

func (*Indexer) CancelJob

func (s *Indexer) CancelJob() (JobStatus, error)

CancelJob cancels a running reindex job

func (*Indexer) DeletePost

func (s *Indexer) DeletePost(ctx context.Context, postID string) error

DeletePost deletes a post from the index

func (*Indexer) GetJobStatus

func (s *Indexer) GetJobStatus() (JobStatus, error)

GetJobStatus gets the status of the reindex job

func (*Indexer) IndexPost

func (s *Indexer) IndexPost(ctx context.Context, post *model.Post, channel *model.Channel) error

IndexPost indexes a post if it meets the criteria

func (*Indexer) StartReindexJob

func (s *Indexer) StartReindexJob() (JobStatus, error)

StartReindexJob starts a post reindexing job

type JobStatus

type JobStatus struct {
	Status        string    `json:"status"`
	Error         string    `json:"error,omitempty"`
	StartedAt     time.Time `json:"started_at"`
	CompletedAt   time.Time `json:"completed_at,omitempty"`
	ProcessedRows int64     `json:"processed_rows"`
	TotalRows     int64     `json:"total_rows"`
}

JobStatus represents the status of a reindex job

type PostRecord

type PostRecord struct {
	ID       string `db:"id"`
	Message  string `db:"message"`
	UserID   string `db:"userid"`
	CreateAt int64  `db:"createat"`
	TeamID   string `db:"teamid"`

	ChannelID   string `db:"channelid"`
	ChannelName string `db:"channelname"`
	ChannelType string `db:"channeltype"`
}

PostRecord represents a post record from the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL