fuzzy

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

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

Index provides efficient fuzzy search over a fixed set of records. It is designed to return results at interactive speeds (tens of ms) for hundreds of thousands of records.

func NewIndex

func NewIndex(records []string) *Index

NewIndex constructs a new index for the set of records. Records are identified by indices in the records slice. The ranking algorithm takes time proportional to the length of each record, so the caller should truncate long record strings.

func (*Index) Search

func (idx *Index) Search(query string) []int

Search returns record IDs that match the query, ordered from most- to least-relevant. The ranking algorithm takes time proportional to the length of the query, so the caller should truncate long queries.

Jump to

Keyboard shortcuts

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