Documentation ¶
Overview ¶
package core 这是一个B+树的缓存,底层实现用到了mmap。 如果是使用vagrant或者是虚拟机,数据库文件不能存放到共享目录里面。 https://stackoverflow.com/questions/18420473/invalid-argument-for-read-write-mmap
Package index
Index ¶
- Constants
- func If(expr bool, f1, f2 func() bool) bool
- type BTree
- func (t *BTree) AddBTree(btname []byte) error
- func (t *BTree) Close() error
- func (t *BTree) Debug(btname []byte)
- func (t *BTree) Delete(btname, key []byte) error
- func (t *BTree) DeleteBTree(btname []byte) error
- func (t *BTree) GetDB() *bolt.DB
- func (t *BTree) Keys(btname []byte, len int) [][]byte
- func (t *BTree) Len(btname []byte) int
- func (t *BTree) Prefix(btname []byte, prefix []byte) ([][]byte, [][]byte, bool, error)
- func (t *BTree) Search(btname []byte, key []byte) ([]byte, bool, error)
- func (t *BTree) Set(btname, key []byte, value []byte) error
- type Bitmap
- func (b *Bitmap) Backup() error
- func (b *Bitmap) ClearAll() error
- func (b *Bitmap) Close() error
- func (b *Bitmap) Len() uint32
- func (b *Bitmap) NextClear(i uint32) (uint32, bool)
- func (b *Bitmap) NextSet(i uint32) (uint32, bool)
- func (b *Bitmap) Set(i uint32) error
- func (b *Bitmap) SetTo(i uint32, value bool) error
- func (b *Bitmap) Test(i uint32) bool
- func (b *Bitmap) Uints(status bool) []uint32
- type Document
- type Index
- func (index *Index) AddDocument(doc *Document) error
- func (index *Index) Buckets() (map[string]int, error)
- func (index *Index) CheckParam(param *Param)
- func (index *Index) ClearAll() error
- func (index *Index) Close() error
- func (index *Index) Commit() error
- func (index *Index) GetDB() *bolt.DB
- func (index *Index) PageSizeDocIds(docIds []uint32, offset, size int) []uint32
- func (index *Index) Search(pars *Param) (int, []*Document, error)
- func (index *Index) SearchAll(pars *Param) (int, []*Document, error)
- func (index *Index) SearchAllDocIds(status bool) ([]uint32, error)
- func (index *Index) SearchCategory(category ...string) ([]uint32, error)
- func (index *Index) SearchDocIds(param *Param) (int, []uint32, error)
- func (index *Index) SearchKeyWords(queries []string) ([]uint32, error)
- func (index *Index) SearchPks(pks ...string) ([]uint32, error)
- func (index *Index) SearchTag(tags ...string) ([]uint32, error)
- func (index *Index) SortDocIds(param *Param, docIds []uint32) []uint32
- func (index *Index) ToDocuments(docIds ...uint32) []*Document
- type InvertIndex
- func (t *InvertIndex) AppendBytesUints(key []byte, value ...uint32) error
- func (t *InvertIndex) AppendUint64Uints(key uint64, value ...uint32) error
- func (t *InvertIndex) AppendUintUints(key uint32, value ...uint32) error
- func (t *InvertIndex) ClearAll() error
- func (t *InvertIndex) Debug()
- func (t *InvertIndex) DeleteByKey(key []byte) error
- func (t *InvertIndex) DeleteBytesUints(key []byte, value ...uint32) error
- func (t *InvertIndex) DeleteUIntBytes(key uint32) error
- func (t *InvertIndex) DeleteUint(key uint32) error
- func (t *InvertIndex) DeleteUint64Uints(key uint64, value ...uint32) error
- func (t *InvertIndex) DeleteUintUints(key uint32, value ...uint32) error
- func (t *InvertIndex) Keys(len int) [][]byte
- func (t *InvertIndex) Len() int
- func (t *InvertIndex) PrefixKeys(pre uint32) ([][]byte, bool, error)
- func (t *InvertIndex) SearchBytesUints(key []byte) ([]uint32, bool, error)
- func (t *InvertIndex) SearchUIntBytes(key uint32) ([]byte, bool, error)
- func (t *InvertIndex) SearchUint64Uints(key uint64) ([]uint32, bool, error)
- func (t *InvertIndex) SearchUintUint(key uint32) (uint32, bool, error)
- func (t *InvertIndex) SearchUintUints(key uint32) ([]uint32, bool, error)
- func (t *InvertIndex) SearchUintsInt16(key []uint32) (int16, bool, error)
- func (t *InvertIndex) SetUInt64Uints(key uint64, value ...uint32) error
- func (t *InvertIndex) SetUIntBytes(key uint32, value []byte) error
- func (t *InvertIndex) SetUIntUint(key uint32, value uint32) error
- func (t *InvertIndex) SetUIntUints(key uint32, value []uint32) error
- func (t *InvertIndex) SetUIntsInt16(key []uint32, value int16) error
- type Param
- type Sorter
Constants ¶
View Source
const ( ASC = true DESC = false )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BTree ¶
type BTree struct {
// contains filtered or unexported fields
}
func (*BTree) DeleteBTree ¶
type Document ¶
type Document struct { DocId uint32 `json:"-"` PK string `json:"pk"` Title string `json:"title"` PubDate int64 `json:"pub_date"` Brief string `json:"brief"` FullText string `json:"full_text"` Tags []string `json:"tags"` Category string `json:"category"` Link string `json:"link"` Figure string `json:"figure"` PV int `json:"pv"` }
Document ...
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) AddDocument ¶
func (*Index) CheckParam ¶
CheckParam check if param is error. Offset default value is 0. Size default value is 10.
func (*Index) PageSizeDocIds ¶
PageSizeDocIds ...
func (*Index) SearchAllDocIds ¶ added in v1.0.2
SearchDocIds ...
func (*Index) SearchCategory ¶
SearchCategory ...
func (*Index) SearchDocIds ¶
SearchDocIds ...
func (*Index) SearchKeyWords ¶
SearchKeyWords search by keywords. If query is english, it should be lower case.
func (*Index) SortDocIds ¶
SortDocIds ...
func (*Index) ToDocuments ¶
ToDocuments ...
type InvertIndex ¶
type InvertIndex struct {
// contains filtered or unexported fields
}
func NewInvertIndex ¶
func NewInvertIndex(btname []byte, btree *BTree) (*InvertIndex, error)
func (*InvertIndex) AppendBytesUints ¶
func (t *InvertIndex) AppendBytesUints(key []byte, value ...uint32) error
func (*InvertIndex) AppendUint64Uints ¶
func (t *InvertIndex) AppendUint64Uints(key uint64, value ...uint32) error
func (*InvertIndex) AppendUintUints ¶
func (t *InvertIndex) AppendUintUints(key uint32, value ...uint32) error
func (*InvertIndex) ClearAll ¶
func (t *InvertIndex) ClearAll() error
func (*InvertIndex) Debug ¶
func (t *InvertIndex) Debug()
func (*InvertIndex) DeleteByKey ¶
func (t *InvertIndex) DeleteByKey(key []byte) error
func (*InvertIndex) DeleteBytesUints ¶
func (t *InvertIndex) DeleteBytesUints(key []byte, value ...uint32) error
func (*InvertIndex) DeleteUIntBytes ¶
func (t *InvertIndex) DeleteUIntBytes(key uint32) error
func (*InvertIndex) DeleteUint ¶
func (t *InvertIndex) DeleteUint(key uint32) error
func (*InvertIndex) DeleteUint64Uints ¶
func (t *InvertIndex) DeleteUint64Uints(key uint64, value ...uint32) error
func (*InvertIndex) DeleteUintUints ¶
func (t *InvertIndex) DeleteUintUints(key uint32, value ...uint32) error
func (*InvertIndex) Keys ¶
func (t *InvertIndex) Keys(len int) [][]byte
func (*InvertIndex) Len ¶
func (t *InvertIndex) Len() int
func (*InvertIndex) PrefixKeys ¶
func (t *InvertIndex) PrefixKeys(pre uint32) ([][]byte, bool, error)
func (*InvertIndex) SearchBytesUints ¶
func (t *InvertIndex) SearchBytesUints(key []byte) ([]uint32, bool, error)
func (*InvertIndex) SearchUIntBytes ¶
func (t *InvertIndex) SearchUIntBytes(key uint32) ([]byte, bool, error)
func (*InvertIndex) SearchUint64Uints ¶
func (t *InvertIndex) SearchUint64Uints(key uint64) ([]uint32, bool, error)
func (*InvertIndex) SearchUintUint ¶
func (t *InvertIndex) SearchUintUint(key uint32) (uint32, bool, error)
func (*InvertIndex) SearchUintUints ¶
func (t *InvertIndex) SearchUintUints(key uint32) ([]uint32, bool, error)
func (*InvertIndex) SearchUintsInt16 ¶
func (t *InvertIndex) SearchUintsInt16(key []uint32) (int16, bool, error)
func (*InvertIndex) SetUInt64Uints ¶
func (t *InvertIndex) SetUInt64Uints(key uint64, value ...uint32) error
func (*InvertIndex) SetUIntBytes ¶
func (t *InvertIndex) SetUIntBytes(key uint32, value []byte) error
func (*InvertIndex) SetUIntUint ¶
func (t *InvertIndex) SetUIntUint(key uint32, value uint32) error
func (*InvertIndex) SetUIntUints ¶
func (t *InvertIndex) SetUIntUints(key uint32, value []uint32) error
func (*InvertIndex) SetUIntsInt16 ¶
func (t *InvertIndex) SetUIntsInt16(key []uint32, value int16) error
Click to show internal directories.
Click to hide internal directories.