move index mapping to const variables

This commit is contained in:
ston1th 2019-08-24 18:49:16 +02:00
commit d29ec19abc
2 changed files with 19 additions and 12 deletions

View file

@ -15,8 +15,10 @@ import (
const (
maxSearchResult = 101
docType = "page"
docType = "page"
titleField = "title"
storeTitleField = "store_title"
searchField = "search"
)
type indexPage struct {
@ -110,7 +112,7 @@ func (i *Index) Search(search string) (results []core.Result, err error) {
continue
}
for fragField, frags := range hit.Fragments {
if fragField == "title" || fragField == "search" {
if fragField == titleField || fragField == searchField {
for _, f := range frags {
r.HTML += template.HTML(f)
}