searcher

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAll

func MakeAll(cfg *config.Config) (map[string]*Searcher, map[string]error, error)

Make a searcher for each repo in the Config. This function kind of has a notion of partial errors. First, if the error returned is non-nil then a fatal error has occurred and no other return values are valid. If an error occurs that is specific to a particular searcher, that searcher will not be present in the searcher map and will have an error entry in the error map.

Types

type Searcher

type Searcher struct {
	Repo *config.Repo
	// contains filtered or unexported fields
}

func New

func New(dbpath, name string, repo *config.Repo) (*Searcher, error)

Creates a new Searcher that is available for searches as soon as this returns. This will pull or clone the target repo and start watching the repo for changes.

func (*Searcher) GetExcludedFiles

func (s *Searcher) GetExcludedFiles() string

Get the excluded files as a JSON string. This is only used for returning the data directly to clients (thus JSON).

func (*Searcher) Search

func (s *Searcher) Search(pat string, opt *index.SearchOptions) (*index.SearchResponse, error)

Perform a basic search on the current index using the supplied pattern and the options.

TODO(knorton): pat should really just be a part of SearchOptions

func (*Searcher) Stop

func (s *Searcher) Stop()

Shut down the searcher cleanly, waiting for any indexing operations to complete.

func (*Searcher) Update

func (s *Searcher) Update() bool

Triggers an immediate poll of the repository.

func (*Searcher) Wait

func (s *Searcher) Wait()

Blocks until the searcher's associated goroutine is stopped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL