Documentation
¶
Index ¶
- Constants
- Variables
- func RunFileWorkers[T any](ctx context.Context, dir string, ext string, workerCount int, ...) <-chan T
- type LyricIndex
- type LyricItem
- type LyricsClient
- func (client *LyricsClient) AddDoc(id string, data any) error
- func (client *LyricsClient) AddDocMapping(docMapping *mapping.DocumentMapping, typestr string) *LyricsClient
- func (client *LyricsClient) AddDocs(b *bleve.Batch) error
- func (client *LyricsClient) BuildSearchFiled(fields []LyricsSearchFiled) *bleve.SearchRequest
- func (client *LyricsClient) Close() error
- func (client *LyricsClient) CreateIndex() (bool, error)
- func (client *LyricsClient) CreateIndexMapping() *LyricsClient
- func (client *LyricsClient) DeleteDoc(id string) error
- func (client *LyricsClient) DocCount() int64
- func (client *LyricsClient) FindList(request *bleve.SearchRequest, isHeigLight bool) ([]map[string]interface{}, *bleve.SearchResult, error)
- func (client *LyricsClient) FindOne(request *bleve.SearchRequest, isHeigLight bool) (map[string]interface{}, *bleve.SearchResult, error)
- func (client *LyricsClient) GetIndex() bleve.Index
- func (client *LyricsClient) GetTermFrequency(field string, exclude []string, minFreq int) (map[string]int, error)
- func (client *LyricsClient) UpdateDoc(id string, data any) error
- type LyricsSearchFiled
- type Task
- type TermFreq
- type WorkerFunc
Constants ¶
View Source
const ( RawLyrics = iota SpotifyLyrics QQLyrics NcmLyrics AmLyrics )
并发读取解析ttml文件 读取方法
Variables ¶
View Source
var LyricTypeMap = map[int]string{ RawLyrics: "RawLyrics", SpotifyLyrics: "SpotifyLyrics", QQLyrics: "QQLyrics", NcmLyrics: "NcmLyrics", AmLyrics: "AmLyrics", }
View Source
var LyricTypeMapZh = map[int]string{ RawLyrics: "原始歌词", SpotifyLyrics: "Spotify歌词", QQLyrics: "QQ歌词", NcmLyrics: "网易云歌词", AmLyrics: "Apple music歌词", }
Functions ¶
Types ¶
type LyricIndex ¶
type LyricsClient ¶
type LyricsClient struct {
DocType string
Analyzer string
// contains filtered or unexported fields
}
func (*LyricsClient) AddDoc ¶
func (client *LyricsClient) AddDoc(id string, data any) error
AddDoc 添加文档
func (*LyricsClient) AddDocMapping ¶
func (client *LyricsClient) AddDocMapping(docMapping *mapping.DocumentMapping, typestr string) *LyricsClient
func (*LyricsClient) BuildSearchFiled ¶
func (client *LyricsClient) BuildSearchFiled(fields []LyricsSearchFiled) *bleve.SearchRequest
func (*LyricsClient) Close ¶
func (client *LyricsClient) Close() error
func (*LyricsClient) CreateIndex ¶
func (client *LyricsClient) CreateIndex() (bool, error)
func (*LyricsClient) CreateIndexMapping ¶
func (client *LyricsClient) CreateIndexMapping() *LyricsClient
CreateIndexMapping 创建索引并将字段映射添加到索引
func (*LyricsClient) DeleteDoc ¶
func (client *LyricsClient) DeleteDoc(id string) error
func (*LyricsClient) DocCount ¶
func (client *LyricsClient) DocCount() int64
func (*LyricsClient) FindList ¶
func (client *LyricsClient) FindList(request *bleve.SearchRequest, isHeigLight bool) ([]map[string]interface{}, *bleve.SearchResult, error)
core.go (请将此代码替换你的 FindList 函数)
func (*LyricsClient) FindOne ¶
func (client *LyricsClient) FindOne(request *bleve.SearchRequest, isHeigLight bool) (map[string]interface{}, *bleve.SearchResult, error)
func (*LyricsClient) GetTermFrequency ¶
func (client *LyricsClient) GetTermFrequency(field string, exclude []string, minFreq int) (map[string]int, error)
GetTermFrequency 返回指定字段中的词频统计表 参数:
field - 要统计的字段名(如 "_all" 或 "lyrics.text") exclude - 不需要的词列表 minFreq - 过滤掉出现次数低于此值的词
返回:map[term] = totalFrequency
type LyricsSearchFiled ¶
Click to show internal directories.
Click to hide internal directories.