hybrid

package
v1.24.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultLimit = 100

Variables

This section is empty.

Functions

func FusionRanked added in v1.20.0

func FusionRanked(weights []float64, resultSets [][]*search.Result, setNames []string) []*search.Result

func FusionRelativeScore added in v1.20.0

func FusionRelativeScore(weights []float64, resultSets [][]*search.Result, names []string) []*search.Result

FusionRelativeScore uses the relative differences in the scores from keyword and vector search to combine the results. This method retains more information than ranked fusion and should result in better results.

The scores from each result are normalized between 0 and 1, e.g. the maximum score becomes 1 and the minimum 0 and the other scores are in between, keeping their relative distance to the other scores. Example:

Input score = [1, 8, 6, 11] => [0, 0.7, 0.5, 1]

The normalized scores are then combined using their respective weight and the combined scores are sorted

func Search(ctx context.Context, params *Params, logger logrus.FieldLogger, sparseSearch sparseSearchFunc,
	denseSearch denseSearchFunc, postProc postProcFunc, modules modulesProvider,
	schemaGetter uc.SchemaGetter, targetVectorParamHelper targetVectorParamHelper,
) ([]*search.Result, error)

Search executes sparse and dense searches and combines the result sets using Reciprocal Rank Fusion

Types

type Params

type Params struct {
	*searchparams.HybridSearch
	Keyword *searchparams.KeywordRanking
	Class   string
	Autocut int
}

type Results

type Results []*search.Result

Jump to

Keyboard shortcuts

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