Documentation ¶
Overview ¶
vim:ts=4:sw=4:noet
Index ¶
- func Concat(dst, src1, src2 string)
- func ConcatN(dst string, sources ...string)
- func File() string
- func Merge(dst, src1, src2 string)
- type Index
- func (ix *Index) Close()
- 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 Concat ¶
func Concat(dst, src1, src2 string)
src1 and src2 must not cover the same files. dst will contain an index that contains src1 and src2.
Types ¶
type Index ¶
An Index implements read-only access to a trigram index.
func (*Index) PostingList ¶
func (*Index) PostingQuery ¶
type IndexWriter ¶
type IndexWriter struct { LogSkip bool // log information about skipped files Verbose bool // log status using package log // contains filtered or unexported fields }
An IndexWriter creates an on-disk index corresponding to a set of files.
func Create ¶
func Create(file string) *IndexWriter
Create returns a new IndexWriter that will write the index to file.
func (*IndexWriter) Add ¶
func (ix *IndexWriter) Add(name string, f io.Reader) error
Add adds the file f to the index under the given name. It logs errors using package log.
func (*IndexWriter) AddFile ¶
func (ix *IndexWriter) AddFile(name string, indexname string) error
AddFile adds the file with the given name (opened using os.Open) to the index. It logs errors using package log.
func (*IndexWriter) AddPaths ¶
func (ix *IndexWriter) AddPaths(paths []string)
AddPaths adds the given paths to the index's list of paths.
func (*IndexWriter) Flush ¶
func (ix *IndexWriter) Flush()
Flush flushes the index entry to the target file.
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.