ranking

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeoDecay

func GeoDecay(lat1, lon1, lat2, lon2, scale float64) float64

GeoDecay 高斯距离衰减(0-1),scale 为衰减尺度

func GeoDistance

func GeoDistance(lat1, lon1, lat2, lon2 float64) float64

GeoDistance 计算两个经纬度之间的 haversine 距离(米)

func GeoInRange

func GeoInRange(lat1, lon1, lat2, lon2, radius float64) bool

GeoInRange 判断点是否在半径范围内

func GeoLinear

func GeoLinear(lat1, lon1, lat2, lon2, maxDist float64) float64

GeoLinear 线性距离衰减(0-1),maxDist 为最大距离

Types

type RerankRequest

type RerankRequest struct {
	Hits   []meta.Hit
	Query  string
	UserID string
}

RerankRequest 重排序请求

type Reranker

type Reranker interface {
	Rerank(req *RerankRequest) ([]meta.Hit, error)
}

Reranker 重排序接口 实现此接口可对搜索结果进行二次排序

type ScriptScoreConfig

type ScriptScoreConfig struct {
	Script      string   `json:"script"`
	Fields      []string `json:"fields"`
	ExtractSize int      `json:"extract_size"`
}

ScriptScoreConfig script_score 配置

type ScriptScorer

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

ScriptScorer 表达式执行器

func NewScriptScorer

func NewScriptScorer(cfg *ScriptScoreConfig) (*ScriptScorer, error)

NewScriptScorer 创建表达式执行器并预编译

func (*ScriptScorer) Score

func (s *ScriptScorer) Score(bm25Score float64, source map[string]interface{}) (float64, error)

Score 对单个文档执行表达式计算 bm25Score: bluge 原始 BM25 分数 source: 文档的 _source 字段

Jump to

Keyboard shortcuts

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