Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeltaReader ¶
type DeltaReader struct {
// contains filtered or unexported fields
}
A DeltaReader reads up to 256 deltas at a time (i.e. one TurboPFor block), which is useful for copying index data in a windowed fashion (for merging).
func NewDeltaReader ¶
func NewDeltaReader() *DeltaReader
func (*DeltaReader) Read ¶
func (dr *DeltaReader) Read() []uint32
Read returns up to 256 uint32 deltas.
When all deltas have been read, Read returns nil.
The first Read call after Reset returns a non-nil result.
func (*DeltaReader) Reset ¶
func (dr *DeltaReader) Reset(meta *MetaEntry, data []byte)
Reset positions the reader on a posting list.
type DocidReader ¶
type DocidReader struct { Count int // contains filtered or unexported fields }
func (*DocidReader) All ¶
func (dr *DocidReader) All() io.Reader
func (*DocidReader) Close ¶
func (dr *DocidReader) Close() error
type ErrFunc ¶
An ErrFunc is called for each error adding a file to the index, allowing the caller to take action (e.g. delete the not added files to conserve disk space). If the ErrFunc returns a non-nil error, indexing is aborted.
type IgnoreFunc ¶
An IgnoreFunc returns a non-nil error describing the reason why the file should not be added to the index, or nil if it should be added.
type Index ¶
type Index struct { DocidMap *DocidReader // docid → filename mapping Docid *PForReader // docids for all trigrams Pos *PForReader // positions for all trigrams Posrel *PosrelReader // position relationships for all trigrams // contains filtered or unexported fields }
func (*Index) PostingQuery ¶
type MetaEntry ¶
type MetaEntry struct { Trigram Trigram Entries uint32 // number of entries (excluding padding) OffsetData int64 // delta offset within the corresponding .data or .turbopfor file }
A MetaEntry specifies the offset (in the corresponding data file) and number of entries for each trigram.
type PForReader ¶
type PForReader struct {
// contains filtered or unexported fields
}
func (*PForReader) Close ¶
func (sr *PForReader) Close() error
type PosrelReader ¶
type PosrelReader struct {
// contains filtered or unexported fields
}
func (*PosrelReader) Close ¶
func (pr *PosrelReader) Close() error
type Query ¶
A Query is a matching machine, like a regular expression, that matches some text and not other text. When we compute a Query from a regexp, the Query is a conservative version of the regexp: it matches everything the regexp would match, and probably quite a bit more. We can then filter target files by whether they match the Query (using a trigram index) before running the comparatively more expensive regexp machinery.
func RegexpQuery ¶
RegexpQuery returns a Query for the given regexp.
type SuccessFunc ¶
A SuccessFunc is called for each file which was successfully added to the index.