largest

package
v0.50.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Value  search.Entity[search.Value]
	Weight float64
}

type Items

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

Items keeps track of a set of Items (with a Value and Weight), up to a fixed capacity, only retaining the highest weights (>= minMatch).

func NewItems

func NewItems(capacity int, minMatch float64) *Items

NewItems returns a structure which tracks the top-weighted Items, subject to minMatch and a fixed capacity.

func (*Items) Add

func (xs *Items) Add(it Item)

Add inserts an Item if it meets the minMatch threshold, ensuring we only keep the top N items by Weight.

func (*Items) Items

func (xs *Items) Items() []Item

All returns a copy of all items in descending Weight order.

Jump to

Keyboard shortcuts

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