Documentation
¶
Index ¶
- Constants
- Variables
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func ParseWords(text string) (words []string)
- type Index
- func (ind *Index) Close() (err error)
- func (ind *Index) Del(docID uint64) (found bool, err error)
- func (ind *Index) Destroy() (err error)
- func (ind *Index) GetDocIDFragList() (numList []uint64)
- func (ind *Index) Insert(doc *cql.DocumentWithIdx) (err error)
- func (ind *Index) Open() (err error)
- func (ind *Index) Select(q *cql.CqlSelect) (qr *QueryResult, err error)
- func (ind *Index) Sync() (err error)
- type Indexer
- func (ir *Indexer) ApplySnapshot(snapDir string) (err error)
- func (ir *Indexer) Close() (err error)
- func (ir *Indexer) CreateIndex(docProt *cql.DocumentWithIdx) (err error)
- func (ir *Indexer) CreateSnapshot(snapDir string) (numList []uint64, err error)
- func (ir *Indexer) Del(idxName string, docID uint64) (found bool, err error)
- func (ir *Indexer) Destroy() (err error)
- func (ir *Indexer) DestroyIndex(name string) (err error)
- func (ir *Indexer) GetDocIDFragList() (numList []uint64)
- func (ir *Indexer) GetDocProt(name string) (docProt *cql.DocumentWithIdx)
- func (ir *Indexer) GetDocProts() (sdump string)
- func (ir *Indexer) Insert(doc *cql.DocumentWithIdx) (err error)
- func (ir *Indexer) Open() (err error)
- func (ir *Indexer) Select(q *cql.CqlSelect) (qr *QueryResult, err error)
- func (ir *Indexer) Summary() (sum string, err error)
- func (ir *Indexer) Sync() (err error)
- func (ir *Indexer) WriteMeta() (err error)
- type IntFrame
- func (f *IntFrame) BitDepth() uint
- func (f *IntFrame) Close() (err error)
- func (f *IntFrame) Destroy() (err error)
- func (f *IntFrame) DoIndex(docID uint64, val uint64) (err error)
- func (f *IntFrame) FragmentPath(slice uint64) string
- func (f *IntFrame) GetFragList() (numList []uint64)
- func (f *IntFrame) GetValue(docID uint64) (val uint64, exists bool, err error)
- func (f *IntFrame) Index() string
- func (f *IntFrame) Name() string
- func (f *IntFrame) Open() (err error)
- func (f *IntFrame) Path() string
- func (f *IntFrame) QueryRange(op pql.Token, predicate uint64) (bm *pilosa.Bitmap, err error)
- func (f *IntFrame) QueryRangeBetween(predicateMin, predicateMax uint64) (bm *pilosa.Bitmap, err error)
- func (f *IntFrame) Sync() (err error)
- type QueryResult
- type TermDict
- func (td *TermDict) Close() (err error)
- func (td *TermDict) Count() (cnt uint64)
- func (td *TermDict) CreateTermIfNotExist(term string) (id uint64, err error)
- func (td *TermDict) CreateTermsIfNotExist(terms []string) (ids []uint64, err error)
- func (td *TermDict) Destroy() (err error)
- func (td *TermDict) GetTermID(term string) (id uint64, found bool)
- func (td *TermDict) Open() (err error)
- func (td *TermDict) Sync() (err error)
- type TextFrame
- func (f *TextFrame) Bits() (bits map[uint64][]uint64, err error)
- func (f *TextFrame) Close() (err error)
- func (f *TextFrame) Count() (cnt uint64, err error)
- func (f *TextFrame) Destroy() (err error)
- func (f *TextFrame) DoIndex(docID uint64, text string) (err error)
- func (f *TextFrame) FragmentPath(slice uint64) string
- func (f *TextFrame) GetFragList() (numList []uint64)
- func (f *TextFrame) Index() string
- func (f *TextFrame) Name() string
- func (f *TextFrame) Open() (err error)
- func (f *TextFrame) Path() string
- func (f *TextFrame) Query(text string) (bm *pilosa.Bitmap)
- func (f *TextFrame) Sync() (err error)
Constants ¶
const ( MaxUint = ^uint(0) MinUint = 0 MaxInt = int(MaxUint >> 1) MinInt = -MaxInt - 1 )
const ( // DefaultIndexerMaxOpN is the default value for Indexer.MaxOpN. DefaultIndexerMaxOpN = uint64(1000000) )
const (
LiveDocs string = "__liveDocs" // the directory where stores Index.liveDocs
)
Variables ¶
var ( ErrUnknownProp = errors.New("unknown property") ErrDocExist = errors.New("document already exist") )
var ( ErrIdxExist = errors.New("index already exist") ErrIdxNotExist = errors.New("index not exist") )
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func ParseWords ¶
ParseWords parses text(encoded in UTF-8) for words. A word is a non-ascii-space lowered ASCII character sequence, or a non-ASCII non-unicode-space non-chinese-punctuate character. Note: words are not de-duplicated.
Types ¶
type Index ¶
type Index struct { MainDir string DocProt *cql.DocumentWithIdx //document prototype. persisted to an index-specific file // contains filtered or unexported fields }
Index is created by CqlCreate
func NewIndex ¶
func NewIndex(docProt *cql.DocumentWithIdx, mainDir string) (ind *Index, err error)
NewIndex creates index according to given conf, overwrites existing files.
func NewIndexExt ¶
NewIndexExt create index according to existing files.
func (*Index) Del ¶
Del executes CqlDel. Do mark-deletion only. The caller shall rebuild index in order to recycle disk space.
func (*Index) GetDocIDFragList ¶
GetDocIDFragList returns DocID fragment list. Each fragment's size is pilosa.SliceWidth
func (*Index) Insert ¶
func (ind *Index) Insert(doc *cql.DocumentWithIdx) (err error)
Insert executes CqlInsert
type Indexer ¶
type Indexer struct { MainDir string //the main directory where stores all indices // Number of operations performed before performing a snapshot. MaxOpN uint64 // contains filtered or unexported fields }
Indexer shall be singleton
func NewIndexer ¶
NewIndexer creates an Indexer.
func (*Indexer) ApplySnapshot ¶
func (*Indexer) CreateIndex ¶
func (ir *Indexer) CreateIndex(docProt *cql.DocumentWithIdx) (err error)
CreateIndex creates index
func (*Indexer) CreateSnapshot ¶
func (*Indexer) DestroyIndex ¶
DestroyIndex destroy given index
func (*Indexer) GetDocIDFragList ¶
func (*Indexer) GetDocProt ¶
func (ir *Indexer) GetDocProt(name string) (docProt *cql.DocumentWithIdx)
GetDocProt returns docProt of given index
func (*Indexer) GetDocProts ¶
GetDocProts dumps docProts
func (*Indexer) Insert ¶
func (ir *Indexer) Insert(doc *cql.DocumentWithIdx) (err error)
Insert executes CqlInsert
func (*Indexer) Select ¶
func (ir *Indexer) Select(q *cql.CqlSelect) (qr *QueryResult, err error)
Select executes CqlSelect.
type IntFrame ¶
type IntFrame struct {
// contains filtered or unexported fields
}
IntFrame represents a string field of an index. Refers to pilosa.Frame and pilosa.View.
func NewIntFrame ¶
NewIntFrame returns a new instance of frame, and initializes it.
func (*IntFrame) Close ¶
Close closes all fragments without removing files on disk. It's allowed to invoke Close multiple times.
func (*IntFrame) Destroy ¶
Destroy closes all fragments, removes all files on disk. It's allowed to invoke Close before or after Destroy.
func (*IntFrame) FragmentPath ¶
FragmentPath returns the path to a fragment
func (*IntFrame) GetFragList ¶
GetFragList returns fragments' numbers
func (*IntFrame) QueryRange ¶
QueryRange query which documents' value is inside the given range.
type QueryResult ¶
type QueryResult struct { Bm *pilosa.Bitmap // used when no OrderBy given Oa *datastructures.OrderedArray // used when OrderBy given }
QueryResult is query result
func NewQueryResult ¶
func NewQueryResult(limit int) (qr *QueryResult)
NewQueryResult creates an empty QueryResult
func (*QueryResult) Merge ¶
func (qr *QueryResult) Merge(other *QueryResult)
Merge merges other (keep unchagned) into qr
type TermDict ¶
type TermDict struct { Dir string // contains filtered or unexported fields }
TermDict stores terms in a map. Note that the term dict is insertion-only.
func NewTermDict ¶
NewTermDict creates and initializes a term dict
func (*TermDict) CreateTermIfNotExist ¶
CreateTermIfNotExist get id of the given term, will insert the term implicitly if it is not in the dict.
func (*TermDict) CreateTermsIfNotExist ¶
CreateTermsIfNotExist is bulk version of CreateTermIfNotExist
type TextFrame ¶
type TextFrame struct {
// contains filtered or unexported fields
}
TextFrame represents a string field of an index. Refers to pilosa.Frame and pilosa.View.
func NewTextFrame ¶
NewTextFrame returns a new instance of frame, and initializes it.
func (*TextFrame) Close ¶
Close closes all fragments without removing files on disk. It's allowed to invoke Close multiple times.
func (*TextFrame) Destroy ¶
Destroy closes all fragments, removes all files on disk. It's allowed to invoke Close before or after Destroy.
func (*TextFrame) FragmentPath ¶
FragmentPath returns the path to a fragment
func (*TextFrame) GetFragList ¶
GetFragList returns fragments' numbers