Source File
searchdoc.go
Belonging Package
golang.org/x/pkgsite/internal/postgres
package postgres
import (
)
const (
maxSectionWords = 50
maxReadmeFraction = 0.5
)
func (, , string) (, , string) {
return searchDocumentSections(, , , maxSectionWords, maxReadmeFraction)
}
func (, , string, int, float64) (, , string) {
var , string
if isMarkdown() {
= processMarkdown()
}
if := sentenceEndIndex(); > 0 {
, = [:+1], [+1:]
} else {
=
}
:= processWords()
:= processWords()
:= processWords()
, := split(, )
var summaryReplacements = map[string][]string{
"postgres": {"postgres", "postgresql"},
"postgresql": {"postgres", "postgresql"},
"rand": {"random"},
"mongo": {"mongo", "mongodb"},
"mongodb": {"mongo", "mongodb"},
"redis": {"redis", "redisdb"},
"redisdb": {"redis", "redisdb"},
"logger": {"logger", "log"}, // Postgres stemmer does not handle -er
"parser": {"parser", "parse"},
"utf-8": {"utf-8", "utf8"},
}
func ( string) []string {
= strings.TrimFunc(, unicode.IsPunct)
if == "" {
return nil
}
if , := summaryReplacements[]; {
return
}
if !hyphenSplit() {
return []string{}
}
return
}
return == ".md" || == ".markdown"
}
func ( string) string {
:= blackfriday.New(blackfriday.WithExtensions(blackfriday.CommonExtensions))
:= .Parse([]byte())
:= walkMarkdown(, nil, 0)
return string()
}
return
return
case blackfriday.Paragraph, blackfriday.Heading:
if len() > 0 {
= append(, ' ')
}
default:
= append(, .Literal...)
}
for := .FirstChild; != nil; = .Next {
= (, , +1)
}
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |