fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Cleanup the artifacts of didYouMean (#215)

There are no producers of this error.

+4 -36
-9
query/parse.go
··· 23 23 24 24 var _ = log.Printf 25 25 26 - type SuggestQueryError struct { 27 - Message string 28 - Suggestion string 29 - } 30 - 31 - func (e *SuggestQueryError) Error() string { 32 - return fmt.Sprintf("%s. Suggestion: %s", e.Message, e.Suggestion) 33 - } 34 - 35 26 // parseStringLiteral parses a string literal, consumes the starting 36 27 // quote too. 37 28 func parseStringLiteral(in []byte) (lit []byte, n int, err error) {
+4 -16
web/server.go
··· 99 99 // domains. 100 100 HostCustomQueries map[string]string 101 101 102 - // This should contain the following templates: "didyoumean" 103 - // (for suggestions), "repolist" (for the repo search result 104 - // page), "result" for the search results, "search" (for the 105 - // opening page), "box" for the search query input element and 102 + // This should contain the following templates: "repolist" 103 + // (for the repo search result page), "result" for 104 + // the search results, "search" (for the opening page), 105 + // "box" for the search query input element and 106 106 // "print" for the show file functionality. 107 107 Top *template.Template 108 108 109 - didYouMean *template.Template 110 109 repolist *template.Template 111 110 search *template.Template 112 111 result *template.Template ··· 148 147 } 149 148 150 149 for k, v := range map[string]**template.Template{ 151 - "didyoumean": &s.didYouMean, 152 150 "results": &s.result, 153 151 "print": &s.print, 154 152 "search": &s.search, ··· 201 199 202 200 func (s *Server) serveSearch(w http.ResponseWriter, r *http.Request) { 203 201 err := s.serveSearchErr(w, r) 204 - 205 - if suggest, ok := err.(*query.SuggestQueryError); ok { 206 - var buf bytes.Buffer 207 - if err := s.didYouMean.Execute(&buf, suggest); err != nil { 208 - http.Error(w, err.Error(), http.StatusTeapot) 209 - } 210 - 211 - w.Write(buf.Bytes()) 212 - return 213 - } 214 202 215 203 if err != nil { 216 204 http.Error(w, err.Error(), http.StatusTeapot)
-11
web/templates.go
··· 25 25 // TemplateText contains the text of the standard templates. 26 26 var TemplateText = map[string]string{ 27 27 28 - "didyoumean": ` 29 - <html> 30 - <head> 31 - <title>Error</title> 32 - </head> 33 - <body> 34 - <p>{{.Message}}. Did you mean <a href="/search?q={{.Suggestion}}">{{.Suggestion}}</a> ? 35 - </body> 36 - </html> 37 - `, 38 - 39 28 "head": ` 40 29 <head> 41 30 <meta charset="utf-8">