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

Configure Feed

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

zoekt: add debug flag to show DebugScore output (#660)

Very useful for quick iteration on ranking work.

Test Plan: go run ./cmd/zoekt -debug foo

+13 -3
+13 -3
cmd/zoekt/main.go
··· 38 38 r = f.Repository + "/" 39 39 } 40 40 if list { 41 - fmt.Printf("%s%s\n", r, f.FileName) 41 + fmt.Printf("%s%s%s\n", r, f.FileName, addTabIfNonEmpty(f.Debug)) 42 42 continue 43 43 } 44 44 45 45 for _, m := range f.LineMatches { 46 - fmt.Printf("%s%s:%d:%s\n", r, f.FileName, m.LineNumber, m.Line) 46 + fmt.Printf("%s%s:%d:%s%s\n", r, f.FileName, m.LineNumber, m.Line, addTabIfNonEmpty(f.Debug)) 47 47 } 48 48 } 49 + } 50 + 51 + func addTabIfNonEmpty(s string) string { 52 + if s != "" { 53 + return "\t" + s 54 + } 55 + return s 49 56 } 50 57 51 58 func loadShard(fn string, verbose bool) (zoekt.Searcher, error) { ··· 130 137 cpuProfile := flag.String("cpu_profile", "", "write cpu profile to `file`") 131 138 fullProfile := flag.String("full_profile", "", "write full profile to `file`") 132 139 profileTime := flag.Duration("profile_time", time.Second, "run this long to gather stats.") 140 + debug := flag.Bool("debug", false, "show debugscore output.") 133 141 verbose := flag.Bool("v", false, "print some background data") 134 142 withRepo := flag.Bool("r", false, "print the repo before the file name") 135 143 list := flag.Bool("l", false, "print matching filenames only") ··· 170 178 log.Println("query:", query) 171 179 } 172 180 173 - var sOpts zoekt.SearchOptions 181 + sOpts := zoekt.SearchOptions{ 182 + DebugScore: *debug, 183 + } 174 184 sres, err := searcher.Search(context.Background(), query, &sOpts) 175 185 if err != nil { 176 186 log.Fatal(err)