textmatch

package
v0.38.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package textmatch provides lexical text similarity scoring — token-set overlap blended with character-trigram similarity — used to rank candidates against a query without embeddings. It complements dense semantic search by rewarding exact identifiers (table names, error strings, refs) and tolerating typos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query holds the precomputed token and trigram sets of a query string so one query can be scored against many candidates cheaply.

func NewQuery

func NewQuery(s string) Query

NewQuery precomputes the token and trigram sets for a query string.

func (Query) Score

func (q Query) Score(fields ...string) float64

Score returns how well the query matches a candidate, taking the best of its fields. It blends token-set overlap (word matches like "getting started" → panda://getting-started) with trigram similarity (typo tolerance like "finalty" → finality), plus a boost when every query token appears in a field. The result is clamped to [0, 1].

Jump to

Keyboard shortcuts

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