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

Configure Feed

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

score: clean up debug output (#663)

+8 -4
+3 -3
contentprovider.go
··· 501 501 maxScore := &debugScore{} 502 502 503 503 addScore := func(what string, s float64) { 504 - if debug { 504 + if s != 0 && debug { 505 505 score.what += fmt.Sprintf("%s:%.2f, ", what, s) 506 506 } 507 507 score.score += s ··· 568 568 } 569 569 570 570 if debug { 571 - maxScore.what = fmt.Sprintf("score:%f <- %s", maxScore.score, strings.TrimRight(maxScore.what, ", ")) 571 + maxScore.what = fmt.Sprintf("score:%.2f <- %s", maxScore.score, strings.TrimSuffix(maxScore.what, ", ")) 572 572 } 573 573 574 574 return maxScore.score, maxScore.what ··· 584 584 maxScore := &debugScore{} 585 585 586 586 addScore := func(what string, s float64) { 587 - if debug { 587 + if s != 0 && debug { 588 588 score.what += fmt.Sprintf("%s:%.2f, ", what, s) 589 589 } 590 590 score.score += s
+5 -1
eval.go
··· 33 33 const maxUInt16 = 0xffff 34 34 35 35 func (m *FileMatch) addScore(what string, s float64, debugScore bool) { 36 - if debugScore { 36 + if s != 0 && debugScore { 37 37 m.Debug += fmt.Sprintf("%s:%.2f, ", what, s) 38 38 } 39 39 m.Score += s ··· 466 466 md := d.repoMetaData[d.repos[doc]] 467 467 fileMatch.addScore("doc-order", scoreFileOrderFactor*(1.0-float64(doc)/float64(len(d.boundaries))), opts.DebugScore) 468 468 fileMatch.addScore("repo-rank", scoreRepoRankFactor*float64(md.Rank)/maxUInt16, opts.DebugScore) 469 + 470 + if opts.DebugScore { 471 + fileMatch.Debug = strings.TrimSuffix(fileMatch.Debug, ", ") 472 + } 469 473 } 470 474 471 475 // scoreFileUsingBM25 computes a score for the file match using an approximation to BM25, the most common scoring