Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// 基础配置
Dimension int
IndexType IndexType
DistanceMetric DistanceMetric
StorageType StorageType
StoragePath string
// 容量配置
MaxVectors int
CacheSize int
// HNSW 参数
M int // 每层最大连接数
EfConstruction int
EfSearch int
// IVF 参数
NumClusters int // 聚类数量
Nprobe int // 搜索时检查的聚类数
// 量化配置
Quantize bool
QuantizerType string
// 性能参数
NumThreads int
// Embedding配置
EmbeddingType EmbeddingType // Embedding类型(默认bm25)
EmbeddingField string // 从Payload中提取文本的字段名(默认"content")
}
Config 数据库配置
type DistanceMetric ¶
type DistanceMetric string
DistanceMetric 距离度量类型
const ( Cosine DistanceMetric = "cosine" // 余弦相似度 L2 DistanceMetric = "l2" // 欧几里得距离 InnerProduct DistanceMetric = "ip" // 内积 )
type EmbeddingType ¶
type EmbeddingType string
EmbeddingType Embedding类型
const ( EmbeddingOpenAI EmbeddingType = "openai" // OpenAI Embedding EmbeddingTFIDF EmbeddingType = "tfidf" // TF-IDF EmbeddingBM25 EmbeddingType = "bm25" // BM25 EmbeddingBM25F EmbeddingType = "bm25f" // BM25F EmbeddingBM25L EmbeddingType = "bm25l" // BM25L EmbeddingBM25P EmbeddingType = "bm25+" // BM25+ )
type IndexSearchResult ¶
IndexSearchResult 索引内部搜索结果
type SearchOptions ¶
type SearchOptions struct {
TopK int // 返回结果数量
MinScore float32 // 最小相似度阈值
MaxDistance float32 // 最大距离阈值
WithVector bool // 是否返回向量数据
WithPayload bool // 是否返回负载数据
Filter map[string]interface{} // Payload过滤条件
}
SearchOptions 搜索选项
type SearchResult ¶
type SearchResult struct {
ID string // 向量 ID
Score float32 // 相似度分数 (0-1,越大越相似)
Distance float32 // 原始距离值
Vector []float32 // 可选:返回向量数据
Payload map[string]interface{} // 可选:返回负载数据
}
SearchResult 搜索结果
type StorageType ¶
type StorageType string
StorageType 存储类型
const ( Memory StorageType = "memory" // 内存存储 Badger StorageType = "badger" // BadgerDB BBolt StorageType = "bbolt" // BBolt Pebble StorageType = "pebble" // PebbleDB MMap StorageType = "mmap" // 内存映射 )
Click to show internal directories.
Click to hide internal directories.