Documentation ¶
Index ¶
- Constants
- type ANSIFragmentFormatter
- type Fragment
- type FragmentFormatter
- type FragmentQueue
- type FragmentScorer
- type Fragmenter
- type HTMLFragmentFormatter
- type Highlighter
- type SimpleFragmentScorer
- type SimpleFragmenter
- type SimpleHighlighter
- func NewANSIHighlighter() *SimpleHighlighter
- func NewANSIHighlighterColor(color string) *SimpleHighlighter
- func NewHTMLHighlighter() *SimpleHighlighter
- func NewHTMLHighlighterTags(before, after string) *SimpleHighlighter
- func NewSimpleHighlighter(fragmenter Fragmenter, formatter FragmentFormatter, separator string) *SimpleHighlighter
- type TermLocation
- type TermLocations
Constants ¶
View Source
const ( Reset = "\x1b[0m" Bright = "\x1b[1m" Dim = "\x1b[2m" Underscore = "\x1b[4m" Blink = "\x1b[5m" Reverse = "\x1b[7m" Hidden = "\x1b[8m" FgBlack = "\x1b[30m" FgRed = "\x1b[31m" FgGreen = "\x1b[32m" FgYellow = "\x1b[33m" FgBlue = "\x1b[34m" FgMagenta = "\x1b[35m" FgCyan = "\x1b[36m" FgWhite = "\x1b[37m" BgBlack = "\x1b[40m" BgRed = "\x1b[41m" BgGreen = "\x1b[42m" BgYellow = "\x1b[43m" BgBlue = "\x1b[44m" BgMagenta = "\x1b[45m" BgCyan = "\x1b[46m" BgWhite = "\x1b[47m" )
ANSI color control escape sequences. Shamelessly copied from https://github.com/sqp/godock/blob/master/libs/log/colors.go
View Source
const DefaultSeparator = "…"
View Source
const Name = "simple"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANSIFragmentFormatter ¶
type ANSIFragmentFormatter struct {
// contains filtered or unexported fields
}
func NewANSIFragmentFormatter ¶
func NewANSIFragmentFormatter() *ANSIFragmentFormatter
func NewANSIFragmentFormatterColor ¶
func NewANSIFragmentFormatterColor(color string) *ANSIFragmentFormatter
func (*ANSIFragmentFormatter) Format ¶
func (a *ANSIFragmentFormatter) Format(f *Fragment, orderedTermLocations TermLocations) string
type FragmentFormatter ¶
type FragmentFormatter interface {
Format(f *Fragment, orderedTermLocations TermLocations) string
}
type FragmentQueue ¶
type FragmentQueue []*Fragment
FragmentQueue implements heap.Interface and holds Items.
func (FragmentQueue) Len ¶
func (fq FragmentQueue) Len() int
func (FragmentQueue) Less ¶
func (fq FragmentQueue) Less(i, j int) bool
func (*FragmentQueue) Pop ¶
func (fq *FragmentQueue) Pop() interface{}
func (*FragmentQueue) Push ¶
func (fq *FragmentQueue) Push(x interface{})
func (FragmentQueue) Swap ¶
func (fq FragmentQueue) Swap(i, j int)
type FragmentScorer ¶
type Fragmenter ¶
type Fragmenter interface {
Fragment([]byte, TermLocations) []*Fragment
}
type HTMLFragmentFormatter ¶
type HTMLFragmentFormatter struct {
// contains filtered or unexported fields
}
func NewHTMLFragmentFormatter ¶
func NewHTMLFragmentFormatter() *HTMLFragmentFormatter
func NewHTMLFragmentFormatterTags ¶
func NewHTMLFragmentFormatterTags(before, after string) *HTMLFragmentFormatter
func (*HTMLFragmentFormatter) Format ¶
func (a *HTMLFragmentFormatter) Format(f *Fragment, orderedTermLocations TermLocations) string
type Highlighter ¶
type Highlighter interface { BestFragment(tlm search.TermLocationMap, orig []byte) string BestFragments(tlm search.TermLocationMap, orig []byte, num int) []string }
type SimpleFragmentScorer ¶
type SimpleFragmentScorer struct {
// contains filtered or unexported fields
}
FragmentScorer will score fragments by how many unique terms occur in the fragment with no regard for any boost values used in the original query
func NewFragmentScorer ¶
func NewFragmentScorer(tlm search.TermLocationMap) *SimpleFragmentScorer
func (*SimpleFragmentScorer) Score ¶
func (s *SimpleFragmentScorer) Score(f *Fragment)
type SimpleFragmenter ¶
type SimpleFragmenter struct {
// contains filtered or unexported fields
}
func NewSimpleFragmenter ¶
func NewSimpleFragmenter() *SimpleFragmenter
func NewSimpleFragmenterSized ¶
func NewSimpleFragmenterSized(fragmentSize int) *SimpleFragmenter
func (*SimpleFragmenter) Fragment ¶
func (s *SimpleFragmenter) Fragment(orig []byte, ot TermLocations) []*Fragment
type SimpleHighlighter ¶
type SimpleHighlighter struct {
// contains filtered or unexported fields
}
func NewANSIHighlighter ¶
func NewANSIHighlighter() *SimpleHighlighter
func NewANSIHighlighterColor ¶
func NewANSIHighlighterColor(color string) *SimpleHighlighter
func NewHTMLHighlighter ¶
func NewHTMLHighlighter() *SimpleHighlighter
func NewHTMLHighlighterTags ¶
func NewHTMLHighlighterTags(before, after string) *SimpleHighlighter
func NewSimpleHighlighter ¶
func NewSimpleHighlighter(fragmenter Fragmenter, formatter FragmentFormatter, separator string) *SimpleHighlighter
func (*SimpleHighlighter) BestFragment ¶
func (s *SimpleHighlighter) BestFragment(tlm search.TermLocationMap, orig []byte) string
func (*SimpleHighlighter) BestFragments ¶
func (s *SimpleHighlighter) BestFragments(tlm search.TermLocationMap, orig []byte, num int) []string
type TermLocation ¶
func (*TermLocation) Overlaps ¶
func (tl *TermLocation) Overlaps(other *TermLocation) bool
type TermLocations ¶
type TermLocations []*TermLocation
func OrderTermLocations ¶
func OrderTermLocations(tlm search.TermLocationMap) TermLocations
func (TermLocations) Len ¶
func (t TermLocations) Len() int
func (TermLocations) Less ¶
func (t TermLocations) Less(i, j int) bool
func (TermLocations) MergeOverlapping ¶
func (t TermLocations) MergeOverlapping()
func (TermLocations) Swap ¶
func (t TermLocations) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.