Documentation ¶
Overview ¶
Package search provides client-side repository searching.
This supports building an in-memory search index based on the contents of multiple repositories, and then using string matching or regular expressions to find matches.
Index ¶
- func SortScore(r []*Result)
- type Index
- func (i *Index) AddRepo(rname string, ind *repo.IndexFile, all bool)
- func (i *Index) All() []*Result
- func (i *Index) Search(term string, threshold int, regexp bool) ([]*Result, error)
- func (i *Index) SearchLiteral(term string, threshold int) []*Result
- func (i *Index) SearchRegexp(re string, threshold int) ([]*Result, error)
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is a searchable index of chart information.
func (*Index) All ¶
All returns all charts in the index as if they were search results.
Each will be given a score of 0.
func (*Index) Search ¶
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 ¶
SearchLiteral does a literal string search (no regexp).