Documentation
¶
Overview ¶
Package picker provides a simple best-match product picker for Frisco search results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pick ¶
Pick finds the best-matching available product from products for the given search phrase.
Rules (in order of priority):
- Only available products are considered.
- Best match score wins.
- Ties broken by lowest PricePerKg (then lowest Price).
Returns (best, topN, ok).
- ok is false when no available product scores >= minScore.
- topN always contains up to 3 candidates (available, scored, sorted), even when ok is false, so callers can display them to the user.
Types ¶
type Product ¶
type Product struct {
ProductID string
Name string
Brand string
Price float64 // price per unit (from price.price)
Grammage string // e.g. "500 g"
PricePerKg float64 // price / weight in kg; 0 when unavailable
Available bool
// raw entry so callers can pass it forward if needed
Raw map[string]any
}
Product is a normalised view of a single product entry from the search API.
func NormaliseProducts ¶
NormaliseProducts converts a raw products slice (as returned by the search API) into a slice of Product values.
Click to show internal directories.
Click to hide internal directories.