indexer_init_options.go 708 B

123456789101112131415161718192021222324252627282930
  1. package types
  2. // 这些常数定义了反向索引表存储的数据类型
  3. const (
  4. // 仅存储文档的docId
  5. DocIdsIndex = 0
  6. // 存储关键词的词频,用于计算BM25
  7. FrequenciesIndex = 1
  8. // 存储关键词在文档中出现的具体字节位置(可能有多个)
  9. // 如果你希望得到关键词紧邻度数据,必须使用LocationsIndex类型的索引
  10. LocationsIndex = 2
  11. )
  12. // 初始化索引器选项
  13. type IndexerInitOptions struct {
  14. // 索引表的类型,见上面的常数
  15. IndexType int
  16. // BM25参数
  17. BM25Parameters *BM25Parameters
  18. }
  19. // 见http://en.wikipedia.org/wiki/Okapi_BM25
  20. // 默认值见engine_init_options.go
  21. type BM25Parameters struct {
  22. K1 float32
  23. B float32
  24. }