index

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddInIndex

func AddInIndex(gist *Gist) error

func Close

func Close()

func DepreactionIndexDirname added in v1.10.0

func DepreactionIndexDirname()

func IndexEnabled added in v1.10.0

func IndexEnabled() bool

func NewIndexer added in v1.10.0

func NewIndexer(idxType IndexerType)

func RemoveFromIndex

func RemoveFromIndex(gistID uint) error

func SearchGists

func SearchGists(query string, metadata SearchGistMetadata, userId uint, page int) ([]uint, uint64, map[string]int, error)

Types

type BleveIndexer added in v1.10.0

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

func NewBleveIndexer added in v1.10.0

func NewBleveIndexer(path string) *BleveIndexer

func (*BleveIndexer) Add added in v1.10.0

func (i *BleveIndexer) Add(gist *Gist) error

func (*BleveIndexer) Close added in v1.10.0

func (i *BleveIndexer) Close()

func (*BleveIndexer) Init added in v1.10.0

func (i *BleveIndexer) Init() error

func (*BleveIndexer) Remove added in v1.10.0

func (i *BleveIndexer) Remove(gistID uint) error

func (*BleveIndexer) Search added in v1.10.0

func (i *BleveIndexer) Search(queryStr string, queryMetadata SearchGistMetadata, userId uint, page int) ([]uint, uint64, map[string]int, error)

type Gist

type Gist struct {
	GistID     uint
	UserID     uint
	Visibility uint
	Username   string
	Title      string
	Content    string
	Filenames  []string
	Extensions []string
	Languages  []string
	Topics     []string
	CreatedAt  int64
	UpdatedAt  int64
}

type Indexer added in v1.7.4

type Indexer interface {
	Init() error
	Close()
	Add(gist *Gist) error
	Remove(gistID uint) error
	Search(query string, metadata SearchGistMetadata, userId uint, page int) ([]uint, uint64, map[string]int, error)
}

type IndexerType added in v1.10.0

type IndexerType string
const (
	Bleve       IndexerType = "bleve"
	Meilisearch IndexerType = "meilisearch"
	None        IndexerType = ""
)

func IndexType added in v1.10.0

func IndexType() IndexerType

type MeiliIndexer added in v1.10.0

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

func NewMeiliIndexer added in v1.10.0

func NewMeiliIndexer(host, apikey, indexName string) *MeiliIndexer

func (*MeiliIndexer) Add added in v1.10.0

func (i *MeiliIndexer) Add(gist *Gist) error

func (*MeiliIndexer) Close added in v1.10.0

func (i *MeiliIndexer) Close()

func (*MeiliIndexer) Init added in v1.10.0

func (i *MeiliIndexer) Init() error

func (*MeiliIndexer) Remove added in v1.10.0

func (i *MeiliIndexer) Remove(gistID uint) error

func (*MeiliIndexer) Search added in v1.10.0

func (i *MeiliIndexer) Search(queryStr string, queryMetadata SearchGistMetadata, userId uint, page int) ([]uint, uint64, map[string]int, error)

type SearchGistMetadata

type SearchGistMetadata struct {
	Username  string
	Title     string
	Filename  string
	Extension string
	Language  string
	Topic     string
}

Jump to

Keyboard shortcuts

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