Documentation
¶
Index ¶
- Constants
- Variables
- func CountItems(cs []*Chunk) int
- func RunBasicBenchmark()
- type ByOrder
- type ByRelevance
- type ByRelevanceTac
- type Case
- type Chunk
- type ChunkCache
- type ChunkList
- type Criterion
- type Fzf
- type History
- type Item
- type ItemBuilder
- type MatchRequest
- type MatchResult
- type Matcher
- type Merger
- type Offset
- type Options
- type Pattern
- type Result
- type SearchResult
Constants ¶
const ( EvtSearchProgress util.EventType = iota EvtSearchFin EvtQuit )
fzf events
Variables ¶
EmptyMerger is a Merger with no data
Functions ¶
func RunBasicBenchmark ¶ added in v0.8.6
func RunBasicBenchmark()
A function that creates a fully internal benchmark, that can be compared in different environments. Note that the benchmark is super basic; use the benchmarks in the test suite if you can
Types ¶
type ByRelevance ¶
type ByRelevance []Result
ByRelevance is for sorting Items
func (ByRelevance) Len ¶
func (a ByRelevance) Len() int
func (ByRelevance) Less ¶
func (a ByRelevance) Less(i, j int) bool
func (ByRelevance) Swap ¶
func (a ByRelevance) Swap(i, j int)
type ByRelevanceTac ¶
type ByRelevanceTac []Result
ByRelevanceTac is for sorting Items
func (ByRelevanceTac) Len ¶
func (a ByRelevanceTac) Len() int
func (ByRelevanceTac) Less ¶
func (a ByRelevanceTac) Less(i, j int) bool
func (ByRelevanceTac) Swap ¶
func (a ByRelevanceTac) Swap(i, j int)
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk is a list of Items whose size has the upper limit of chunkSize
type ChunkCache ¶
type ChunkCache struct {
// contains filtered or unexported fields
}
ChunkCache associates Chunk and query string to lists of items
func (*ChunkCache) Add ¶
func (cc *ChunkCache) Add(chunk *Chunk, key string, list []Result)
Add adds the list to the cache
type ChunkList ¶
type ChunkList struct {
// contains filtered or unexported fields
}
ChunkList is a list of Chunks
func NewChunkList ¶
func NewChunkList(trans ItemBuilder) *ChunkList
NewChunkList returns a new ChunkList
type Fzf ¶
type Fzf struct {
// contains filtered or unexported fields
}
func (*Fzf) GetResultChannel ¶ added in v0.9.0
func (fzf *Fzf) GetResultChannel() <-chan SearchResult
type History ¶
type History struct {
// contains filtered or unexported fields
}
History struct represents input history
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents each input line. 56 bytes.
func (*Item) TrimLength ¶
type ItemBuilder ¶
ItemBuilder is a closure type that builds Item object from byte array
type MatchRequest ¶
type MatchRequest struct {
// contains filtered or unexported fields
}
MatchRequest represents a search request
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is responsible for performing search
type Merger ¶
type Merger struct {
// contains filtered or unexported fields
}
Merger holds a set of locally sorted lists of items and provides the view of a single, globally-sorted list
func PassMerger ¶
PassMerger returns a new Merger that simply returns the items in the original order
type Offset ¶
type Offset [2]int32
Offset holds two 32-bit integers denoting the offsets of a matched substring
type Options ¶
type Options struct {
// If true, each word (separated by non-escaped spaces) is an independent
// searchterm. If false, all spaces are literal
Extended bool
// if true, default is Fuzzy search (' escapes to make exact search)
// if false, default is exact search (' escapes to make fuzzy search)
Fuzzy bool
// CaseRespect, CaseIgnore or CaseSmart
// CaseSmart matches case insensitive if the needle is all lowercase, else case sensitive
CaseMode Case
// set to False to get fzf --literal behaviour:
// "Do not normalize latin script letters for matching."
Normalize bool
// Array with options from {ByScore, ByLength, ByBegin, ByEnd}.
// Metches will first be sorted by the first element, ties will be sorted by
// second element, etc.
// ByScore: Each match is scored (see algo file for more info), higher score
// comes first
// ByLength: Shorter match wins
// ByBegin: Match closer to begin of string wins
// ByEnd: Match closer to end of string wins
//
// If all methods give equal score (including when the Sort slice is empty),
// the result is sorted by HayIndex, the order in which they appeared in
// the input.
Sort []Criterion
}
func DefaultOptions ¶
func DefaultOptions() Options
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern represents search pattern
func BuildPattern ¶
func BuildPattern(fuzzy bool, fuzzyAlgo algo.Algo, extended bool, caseMode Case, normalize bool, forward bool, needle string, sortCriteria []Criterion, patternCache *map[string]*Pattern) *Pattern
buildPattern builds Pattern object from the given arguments
type SearchResult ¶
type SearchResult struct {
Needle string
SearchOptions Options
Matches []MatchResult
}