search

package module
v0.0.0-...-7165a1c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 16 Imported by: 0

README

go-bluge-hl

Go Reference

Package search provides a simple high level wrapper for bluge search, written in Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fuzzy

func Fuzzy(input string, max int) *bluge.TopNSearch

func Normalize

func Normalize(text []byte) []byte

Normalize removes diacritics, transforms to lower case and replaces all non-alphanumeric bytes with spaces.

It is used internally and can be used on input queries which don't have an analyzer (= all except bluge.MatchQuery and bluge.MatchPhraseQuery).

func Prefix

func Prefix(input string, max int) *bluge.TopNSearch

Types

type Pool

type Pool[T any] struct {
	Documents []T
	// contains filtered or unexported fields
}

func MakePool

func MakePool[T any](documents []T, fields map[string]func(T) string) (*Pool[T], error)

func (*Pool[T]) Close

func (pool *Pool[T]) Close() error

func (*Pool[T]) Search

func (pool *Pool[T]) Search(request bluge.SearchRequest) ([]Result[T], error)

type Pool2

type Pool2[A, B any] struct {
	As []A
	Bs []B
	// contains filtered or unexported fields
}

func MakePool2

func MakePool2[A, B any](as []A, aFields map[string]func(A) string, bs []B, bFields map[string]func(B) string) (*Pool2[A, B], error)

func (*Pool2[A, B]) Close

func (pool *Pool2[A, B]) Close() error

func (*Pool2[A, B]) Search

func (pool *Pool2[A, B]) Search(request bluge.SearchRequest) ([]Result[A], []Result[B], error)

type Result

type Result[T any] struct {
	Document   T                        `json:"document"`
	Highlights map[string]template.HTML `json:"highlights"` // key: field name, value: full content or fragment
}

Jump to

Keyboard shortcuts

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