Documentation
¶
Index ¶
- Variables
- func FormatFileSize(size int64) string
- func Hits(text string, words []string) []*pb.Hit
- func Index(lower, str, word string) (int, int)
- func IsWord(r rune) bool
- func NewDB(config *Config) level.DB
- func Size(file string) int64
- func Split(txt string) sets.Strings
- func SplitWord(elems []string) sets.Strings
- func WordsMay(words string) []string
- type App
- type Config
- type Service
- func (p *Service) Close() error
- func (p *Service) Delete(file string)
- func (p *Service) File(file string) (*pb.File, bool)
- func (p *Service) FileByWord(ids []uint32) []uint32
- func (p *Service) FileInfo(file string) *pb.File
- func (p *Service) Files(ids []uint32) []*pb.File
- func (p *Service) FilesByStart(start string) []*pb.File
- func (p *Service) FindWords(fileIDs []uint32, words string) []uint32
- func (p *Service) Hit(file *pb.File, words []string)
- func (p *Service) Index(path string)
- func (p *Service) Reindex()
- func (p *Service) Search(wordses []string) []*pb.File
- func (p *Service) Tag(fid uint32, ts tags.Tags)
- func (p *Service) Word(word string, create bool) uint32
- func (p *Service) WordInfo(word string) *pb.Word
- func (p *Service) WordList(start string) []*pb.Word
- func (p *Service) Words(ids []uint32) []*pb.Word
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFileChange = errors.New("文件发生修改,请索引")
ErrFileChange 文件发生修改.
Functions ¶
func FormatFileSize ¶
FormatFileSize 格式化文件尺寸.
Example ¶
package main import ( "fmt" "gitee.com/xuender/se" ) func main() { fmt.Println(se.FormatFileSize(2048)) fmt.Println(se.FormatFileSize(2)) fmt.Println(se.FormatFileSize(71002048)) fmt.Println(se.FormatFileSize(1024*1024*1024 + 1)) fmt.Println(se.FormatFileSize(1024 * 1024 * 1024 * 1024 * 5)) fmt.Println(se.FormatFileSize(1024 * 1024 * 1024 * 1024 * 1024 * 5)) }
Output: 2KB 2B 67.71MB 1.00GB 5.00TB 5.00EB
Types ¶
type Config ¶
type Config struct { DataBasePath string Deploy bool Limit uint `toml:"-"` Offset uint `toml:"-"` Start string `toml:"-"` Exts []string Ignore []string }
Config 设置.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service 搜索引擎服务.
func NewService ¶
NewService 新建搜索引擎服务.
func (*Service) FileByWord ¶
FileByWord 根据词ID查找文件信息.
func (*Service) FilesByStart ¶
FilesByStart 索引文件列表.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.