Documentation ¶
Index ¶
- func Create(file string) *indexWriter
- func File() string
- func IsCorruptIndexError(err error) bool
- func Merge(dst, src1, src2 string)
- func NewCorruptIndexError(filename string) corruptIndexError
- type Index
- func (ix *Index) Name(fileid uint32) string
- func (ix *Index) NameBytes(fileid uint32) []byte
- func (ix *Index) Paths() []string
- func (ix *Index) PostingAnd(list []uint32, trigram uint32) []uint32
- func (ix *Index) PostingList(trigram uint32) []uint32
- func (ix *Index) PostingOr(list []uint32, trigram uint32) []uint32
- func (ix *Index) PostingQuery(q *Query) []uint32
- type IndexWriter
- type Query
- type QueryOp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(file string) *indexWriter
Create returns a new indexWriter that will write the index to file.
func File ¶
func File() string
File returns the name of the index file to use. It is either $CSEARCHINDEX or $HOME/.csearchindex.
func IsCorruptIndexError ¶
func Merge ¶
func Merge(dst, src1, src2 string)
Merge creates a new index in the file dst that corresponds to merging the two indices src1 and src2. If both src1 and src2 claim responsibility for a path, src2 is assumed to be newer and is given preference.
func NewCorruptIndexError ¶
func NewCorruptIndexError(filename string) corruptIndexError
Types ¶
type Index ¶
type Index struct { Verbose bool // contains filtered or unexported fields }
An Index implements read-only access to a trigram index.
func (*Index) PostingList ¶
func (*Index) PostingQuery ¶
type IndexWriter ¶
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.