func (i *Index) SearchLiteral(term string, threshold int) []*Result {
	term = strings.ToLower(term)
	buf := []*Result{}
	for k, v := range i.lines {
		lk := strings.ToLower(k)
		lv := strings.ToLower(v)
		res := strings.Index(lv, term)
		if score := i.calcScore(res, lv); res != -1 && score < threshold {
			parts := strings.Split(lk, verSep)  
			buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]})
		}
	}
	return buf
}
SearchLiteral does a literal string search (no regexp).
package search
import (
	"errors"
	"path"
	"regexp"
	"sort"
	"strings"
	"github.com/Masterminds/semver"
	"k8s.io/helm/pkg/repo"
)
const (
	sep = "\v"
	verSep = "$$"
)
type Result struct {
	Name  string
	Score int
	Chart *repo.ChartVersion
}
type Index struct {
	lines  map[string]string
	charts map[string]*repo.ChartVersion
}
func NewIndex() *Index {
	return &Index{lines: map[string]string{}, charts: map[string]*repo.ChartVersion{}}
}
func (i *Index) AddRepo(rname string, ind *repo.IndexFile, all bool) {
	ind.SortEntries()
	for name, ref := range ind.Entries {
		if len(ref) == 0 {
			continue
		}
		fname := path.Join(rname, name)
		if !all {
			i.lines[fname] = indstr(rname, ref[0])
			i.charts[fname] = ref[0]
			continue
		}
		for _, rr := range ref {
			versionedName := fname + verSep + rr.Version
			i.lines[versionedName] = indstr(rname, rr)
			i.charts[versionedName] = rr
		}
	}
}
func (i *Index) All() []*Result {
	res := make([]*Result, len(i.charts))
	j := 0
	for name, ch := range i.charts {
		parts := strings.Split(name, verSep)
		res[j] = &Result{
			Name:  parts[0],
			Chart: ch,
		}
		j++
	}
	return res
}
func (i *Index) Search(term string, threshold int, regexp bool) ([]*Result, error) {
	if regexp {
		return i.SearchRegexp(term, threshold)
	}
	return i.SearchLiteral(term, threshold), nil
}
func (i *Index) calcScore(index int, matchline string) int {
	splits := []int{}
	s := rune(sep[0])
	for i, ch := range matchline {
		if ch == s {
			splits = append(splits, i)
		}
	}
	for i, pos := range splits {
		if index > pos {
			continue
		}
		return i
	}
	return len(splits)
}