Version: v0.0.0-...-6c2d9fc Latest Latest

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 8 Imported by: 0



Package search provides search features for Helm Classic.



This section is empty.


View Source
var ErrNoChart = errors.New("no such chart")

ErrNoChart indicates that a chart is not in the chart cache.


func SortScore

func SortScore(r []*Result)

SortScore does an in-place sort of the results.

Lowest scores are highest on the list. Matching scores are subsorted alphabetically.


type Index

type Index struct {
	// contains filtered or unexported fields

Index is a searchable index of chart information.

func NewIndex

func NewIndex(cfg *config.Configfile, cachedir string) *Index

NewIndex creats a new Index.

NewIndex indexes all of the chart tables configured in the config.yaml file. For that reason, it may cause substantial overhead on a large set of repos.

func (*Index) Chart

func (i *Index) Chart(name string) (*chart.Chartfile, error)

Chart gets the *Chartfile for a chart that was found during search.

This is a convenience method for retrieving a cached chart that was located during search indexing.

func (*Index) Search

func (i *Index) Search(term string, threshold int, regexp bool) ([]*Result, error)

Search searches an index for the given term.

Threshold indicates the maximum score a term may have before being marked irrelevant. (Low score means higher relevance. Golf, not bowling.)

If regexp is true, the term is treated as a regular expression. Otherwise, term is treated as a literal string.

func (*Index) SearchLiteral

func (i *Index) SearchLiteral(term string, threshold int) []*Result

SearchLiteral does a literal string search (no regexp).

func (*Index) SearchRegexp

func (i *Index) SearchRegexp(re string, threshold int) ([]*Result, error)

SearchRegexp searches using a regular expression.

type Result

type Result struct {
	Name  string
	Score int

Result is a search result.

Score indicates how close it is to match. The higher the score, the longer the distance.

Source Files

Jump to

Keyboard shortcuts

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