Documentation
¶
Index ¶
- Constants
- func FusionRanked(weights []float64, resultSets [][]*search.Result, setNames []string) []*search.Result
- func FusionRelativeScore(weights []float64, resultSets [][]*search.Result, names []string, ...) []*search.Result
- func HybridCombiner(ctx context.Context, params *Params, resultSet [][]*search.Result, ...) ([]*search.Result, error)
- func Search(ctx context.Context, params *Params, logger logrus.FieldLogger, ...) ([]*search.Result, error)
- type Params
- type Results
Constants ¶
const DefaultLimit = 100
Variables ¶
This section is empty.
Functions ¶
func FusionRanked ¶ added in v1.20.0
func FusionRelativeScore ¶ added in v1.20.0
func FusionRelativeScore(weights []float64, resultSets [][]*search.Result, names []string, descending bool) []*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 HybridCombiner ¶ added in v1.25.0
func HybridCombiner(ctx context.Context, params *Params, resultSet [][]*search.Result, weights []float64, names []string, logger logrus.FieldLogger, postProc postProcFunc) ([]*search.Result, error)
Search combines the result sets using Reciprocal Rank Fusion or Relative Score Fusion
func Search ¶ added in v1.20.4
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 }