indexer

package
v0.0.0-...-5ba556e Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxIndexSize = 600000 // 600KB

)

Variables

This section is empty.

Functions

func StartJobIndex

func StartJobIndex() error

StartJobIndex index sessions in batches based in the period duration A session will be indexed if the indexer plugin is enabled; the session is closed and it contains an e-mail

The index process start a new fresh index and swap it atomically avoiding any downtime in search items in the current index.

See also: http://blevesearch.com/docs/IndexAlias/

Types

type Handler

type Handler struct{}

func (*Handler) Search

func (a *Handler) Search(c *gin.Context)

type Indexer

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

func NewIndexer

func NewIndexer(orgID string) (*Indexer, error)

NewIndexer tries to open the last index from the filesystem or open a fresh one.

func (*Indexer) Close

func (i *Indexer) Close() error

func (*Indexer) Index

func (i *Indexer) Index(sessionID string, data any) error

func (*Indexer) Name

func (i *Indexer) Name() string

func (*Indexer) Search

func (i *Indexer) Search(req *bleve.SearchRequest) (*bleve.SearchResult, error)

type SearchRequest

type SearchRequest struct {
	QueryString string              `json:"query" binding:"required"`
	Limit       int                 `json:"limit"`
	Offset      int                 `json:"offset"`
	Highlighter string              `json:"highlighter"`
	Fields      []string            `json:"fields"`
	Facets      bleve.FacetsRequest `json:"facets"`
}

func NewSearchRequest

func NewSearchRequest(query string, limit, offset int, highlighter string) *SearchRequest

NewSearchRequest creates a new request in the index, possible values for highlighter are

ansi or html

func (*SearchRequest) AddFacet

func (s *SearchRequest) AddFacet(facetName string, f *bleve.FacetRequest)

type Session

type Session struct {
	OrgID string `json:"-"`

	ID                string `json:"session"`
	User              string `json:"user"`
	Connection        string `json:"connection"`
	ConnectionType    string `json:"connection_type"`
	Verb              string `json:"verb"`
	EventSize         int64  `json:"size"`
	Input             string `json:"input"`
	Output            string `json:"output"`
	IsInputTruncated  bool   `json:"isinput_trunc"`
	IsOutputTruncated bool   `json:"isoutput_trunc"`
	IsError           bool   `json:"error"`
	StartDate         string `json:"started"`
	EndDate           string `json:"completed"`
	Duration          int64  `json:"duration"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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