highlight

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 9 modules, 31 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, index.Document, string) string
	BestFragmentsInField(*search.DocumentMatch, index.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