helpers

package
v1.25.25 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ObjectsBucket              = []byte("objects")
	ObjectsBucketLSM           = "objects"
	VectorsCompressedBucketLSM = "vectors_compressed"
	VectorsBucketLSM           = "vectors"
	DimensionsBucketLSM        = "dimensions"
)
View Source
var (
	UseGse          = false
	KagomeKrEnabled = false
)

Optional tokenizers can be enabled with an environment variable like: 'ENABLE_TOKENIZER_XXX', e.g. 'ENABLE_TOKENIZER_GSE', 'ENABLE_TOKENIZER_KAGOME_KR'

Functions

func AnnotateSlowQueryLog added in v1.25.25

func AnnotateSlowQueryLog(ctx context.Context, key string, value any)

func BucketFromPropNameLSM

func BucketFromPropNameLSM(propName string) string

BucketFromPropNameLSM creates string used as the bucket name for a particular prop in the inverted index

func BucketFromPropNameLengthLSM added in v1.18.0

func BucketFromPropNameLengthLSM(propName string) string

func BucketFromPropNameMetaCountLSM added in v1.19.0

func BucketFromPropNameMetaCountLSM(propName string) string

func BucketFromPropNameNullLSM added in v1.18.0

func BucketFromPropNameNullLSM(propName string) string

func BucketSearchableFromPropNameLSM added in v1.19.0

func BucketSearchableFromPropNameLSM(propName string) string

func ExtractSlowQueryDetails added in v1.25.25

func ExtractSlowQueryDetails(ctx context.Context) map[string]any

func InitSlowQueryDetails added in v1.25.25

func InitSlowQueryDetails(ctx context.Context) context.Context

func MetaCountProp

func MetaCountProp(propName string) string

MetaCountProp helps create an internally used propName for meta props that don't explicitly exist in the user schema, but are required for proper indexing, such as the count of arrays.

func PropLength added in v1.19.0

func PropLength(propName string) string

func PropNull added in v1.19.0

func PropNull(propName string) string

func TempBucketFromBucketName added in v1.18.0

func TempBucketFromBucketName(bucketName string) string

func Tokenize added in v1.19.0

func Tokenize(tokenization string, in string) []string

func TokenizeAndCountDuplicates added in v1.19.0

func TokenizeAndCountDuplicates(tokenization string, in string) ([]string, []int)

func TokenizeWithWildcards added in v1.19.0

func TokenizeWithWildcards(tokenization string, in string) []string

Types

type AllowList

type AllowList interface {
	Insert(ids ...uint64)
	Contains(id uint64) bool
	DeepCopy() AllowList
	WrapOnWrite() AllowList
	Slice() []uint64

	IsEmpty() bool
	Len() int
	Min() uint64
	Max() uint64
	Size() uint64
	Truncate(uint64) AllowList

	Iterator() AllowListIterator
	LimitedIterator(limit int) AllowListIterator
}

func NewAllowList added in v1.18.0

func NewAllowList(ids ...uint64) AllowList

func NewAllowListFromBitmap added in v1.18.0

func NewAllowListFromBitmap(bm *sroar.Bitmap) AllowList

func NewAllowListFromBitmapDeepCopy added in v1.18.0

func NewAllowListFromBitmapDeepCopy(bm *sroar.Bitmap) AllowList

type AllowListIterator added in v1.18.0

type AllowListIterator interface {
	Next() (uint64, bool)
	Len() int
}

type BaseSlowReporter added in v1.24.16

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

func NewSlowQueryReporter added in v1.24.16

func NewSlowQueryReporter(threshold time.Duration, logger logrus.FieldLogger) *BaseSlowReporter

func (*BaseSlowReporter) LogIfSlow added in v1.24.16

func (sq *BaseSlowReporter) LogIfSlow(ctx context.Context, startTime time.Time, fields map[string]any)

LogIfSlow prints a warning log if the request takes longer than the threshold. Usage:

	startTime := time.Now()
	defer s.slowQueryReporter.LogIfSlow(startTime, map[string]any{
		"key": "value"
  })

TODO (sebneira): Consider providing fields out of the box (e.g. shard info). Right now we're limited because of circular dependencies.

type KagomeTokenizers added in v1.25.7

type KagomeTokenizers struct {
	Korean *kagomeTokenizer.Tokenizer
}

type NoopSlowReporter added in v1.24.16

type NoopSlowReporter struct{}

NoopSlowReporter is used when the reporter is disabled.

func (*NoopSlowReporter) LogIfSlow added in v1.24.16

func (sq *NoopSlowReporter) LogIfSlow(ctx context.Context, startTime time.Time, fields map[string]any)

type SlowQueryDetails added in v1.25.25

type SlowQueryDetails struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSlowQueryDetails added in v1.25.25

func NewSlowQueryDetails() *SlowQueryDetails

type SlowQueryReporter added in v1.24.16

type SlowQueryReporter interface {
	LogIfSlow(context.Context, time.Time, map[string]any)
}

func NewSlowQueryReporterFromEnv added in v1.24.16

func NewSlowQueryReporterFromEnv(logger logrus.FieldLogger) SlowQueryReporter

Jump to

Keyboard shortcuts

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