search

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package search provides ranked search results over the index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hit

type Hit struct {
	Sources []string `json:"sources,omitempty"`
	ID      string   `json:"id" jsonschema:"id"`
	Title   string   `json:"title" jsonschema:"title"`
	Score   float64  `json:"score" jsonschema:"score"`
	Snippet string   `json:"snippet" jsonschema:"snippet"`
}

func Fuse

func Fuse(keyword, semantic []Hit, limit int) []Hit

Fuse uses one-based ranks and sorts before rounding to preserve close scores.

type Search struct {
	Index    *index.Index
	Embedder embed.Embedder
}

func (Search) Hybrid

func (s Search) Hybrid(ctx context.Context, q string, limit int) ([]Hit, error)

func (Search) Keyword

func (s Search) Keyword(ctx context.Context, q string, limit int) ([]Hit, error)

Keyword returns BM25 results, with lower scores ranking first.

func (Search) Semantic

func (s Search) Semantic(ctx context.Context, q string, limit int) ([]Hit, error)

Jump to

Keyboard shortcuts

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