|
|
@ -147,11 +147,10 @@ func (i *Index) SearchLiteral(term string, threshold int) []*Result {
|
|
|
|
term = strings.ToLower(term)
|
|
|
|
term = strings.ToLower(term)
|
|
|
|
buf := []*Result{}
|
|
|
|
buf := []*Result{}
|
|
|
|
for k, v := range i.lines {
|
|
|
|
for k, v := range i.lines {
|
|
|
|
lk := strings.ToLower(k)
|
|
|
|
|
|
|
|
lv := strings.ToLower(v)
|
|
|
|
lv := strings.ToLower(v)
|
|
|
|
res := strings.Index(lv, term)
|
|
|
|
res := strings.Index(lv, term)
|
|
|
|
if score := i.calcScore(res, lv); res != -1 && score < threshold {
|
|
|
|
if score := i.calcScore(res, lv); res != -1 && score < threshold {
|
|
|
|
parts := strings.Split(lk, verSep) // Remove version, if it is there.
|
|
|
|
parts := strings.Split(k, verSep) // Remove version, if it is there.
|
|
|
|
buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]})
|
|
|
|
buf = append(buf, &Result{Name: parts[0], Score: score, Chart: i.charts[k]})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|