Documentation
¶
Index ¶
Constants ¶
const DefaultLimit = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Params ¶
type Params struct { *searchparams.HybridSearch Keyword *searchparams.KeywordRanking Class string Autocut int }
type Result ¶
Result facilitates the pairing of a search result with its internal doc id.
This type is key in generalising hybrid search across different use cases. Some use cases require a full search result (Get{} queries) and others need only a doc id (Aggregate{}) which the search.Result type does not contain.
func FusionRanked ¶ added in v1.20.0
func FusionRelativeScore ¶ added in v1.20.0
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
type Results ¶
type Results []*Result
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) (Results, error)
Search executes sparse and dense searches and combines the result sets using Reciprocal Rank Fusion