highlight

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

type Fragment struct {
	Orig           []byte
	ArrayPositions []uint64
	Start          int
	End            int
	Score          float64
	Index          int // used by heap
}

func (*Fragment) Overlaps

func (f *Fragment) Overlaps(other *Fragment) bool

type FragmentFormatter

type FragmentFormatter interface {
	Format(f *Fragment, orderedTermLocations TermLocations) string
}

type FragmentScorer

type FragmentScorer interface {
	Score(f *Fragment) float64
}

type Fragmenter

type Fragmenter interface {
	Fragment([]byte, TermLocations) []*Fragment
}

type Highlighter

type Highlighter interface {
	Fragmenter() Fragmenter
	SetFragmenter(Fragmenter)

	FragmentFormatter() FragmentFormatter
	SetFragmentFormatter(FragmentFormatter)

	Separator() string
	SetSeparator(string)

	BestFragmentInField(*search.DocumentMatch, *document.Document, string) string
	BestFragmentsInField(*search.DocumentMatch, *document.Document, string, int) []string
}

type TermLocation

type TermLocation struct {
	Term           string
	ArrayPositions search.ArrayPositions
	Pos            int
	Start          int
	End            int
}

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)

Directories

Path Synopsis
format
fragmenter
highlighter

Jump to

Keyboard shortcuts

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