Documentation ¶
Overview ¶
Package for library
Index ¶
- Constants
- Variables
- type Filter
- type Indexer
- func (i *Indexer) Close() error
- func (i *Indexer) DocCount() (uint64, error)
- func (i *Indexer) Index() (string, error)
- func (i *Indexer) IndexName() (string, error)
- func (i *Indexer) LastIndexed() (time.Time, error)
- func (i *Indexer) Open() error
- func (i *Indexer) OpenAndSwap(name string) error
- func (i *Indexer) Search(term string) (*bleve.SearchResult, error)
- func (i *Indexer) SearchWith(req *bleve.SearchRequest) (*bleve.SearchResult, error)
- type IndexerOption
- type LocationOption
Constants ¶
const (
HeadFileName = "HEAD"
)
Variables ¶
var ( // Error where index is not opened ErrIndexNotOpened = errors.New("index is not opened") // Error where HEAD file does not exists, it should only occur when opened without previously indexed ErrIndexHeadDoesNotExist = fmt.Errorf("cannot open index, %v file does not exist", HeadFileName) )
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter string
Filter for filtering file entries while traversing through file trees
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer manages file path indexes, which provides atomic reindex swapping
func NewIndexer ¶
func NewIndexer(basePath string, options ...IndexerOption) (*Indexer, error)
NewIndexer with specified base path and list of IndexerOptions
func (*Indexer) Close ¶
Close currently opened index Except currently opened one (specified by HEAD file), other indexes will be clean up and removed, to keep index path clean
func (*Indexer) Index ¶
Index will create new index from scratch for all file entries Such that files generations and deletions are not required to be tracked To use newly created index, use OpenAndSwap with returned index name
func (*Indexer) IndexName ¶
IndexName returns current loaded index name If index not opened, ErrIndexNotOpened is returned
func (*Indexer) LastIndexed ¶
LastIndexer returns modification time of the index, as the index will not be updated once indexed
func (*Indexer) Open ¶
Open HEAD file specified index to be available for search and querying If HEAD file is not found, ErrIndexHeadDoesNotExist will returned If already opened, open again will simply check for the latest index specified in HEAD file and swap for it
func (*Indexer) OpenAndSwap ¶
OpenAndSwap writes specified index to HEAD file, open and swap it with current index If same named index is already opened, only HEAD file will be overwritten again, no index will be swapped If no index is loaded, it will create/update HEAD file with specified index, open and load it
func (*Indexer) SearchWith ¶
SearchWith for custom bleve search request for the underlying index
type IndexerOption ¶
type IndexerOption func(*Indexer)
IndexerOption for options on indexing setup
func WithLocation ¶
func WithLocation(path string, option LocationOption) IndexerOption
WithLocation allows specificing directory location and options for traversing it
type LocationOption ¶
type LocationOption struct { // Filters for files and directories from the location path Filters []Filter // Ignores is list of gitignore patterns for ignoring files and directories // It allows nested string structures Ignores []interface{} }
LocationOption of options on traversing the specified directory location tree
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Ignorer package for fzd, which wraps github.com/sabhiram/go-gitignore package for support of nested structure for gitignore styled strings
|
Ignorer package for fzd, which wraps github.com/sabhiram/go-gitignore package for support of nested structure for gitignore styled strings |
Walker package for fzd, which wraps github.com/karrick/godirwalk package for more similar interface as filepath.Walk
|
Walker package for fzd, which wraps github.com/karrick/godirwalk package for more similar interface as filepath.Walk |