alpha
Login
or
Join now
boltless.me
/
zoekt
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
fork of https://github.com/sourcegraph/zoekt
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
score: clean up debug output (#663)
author
Keegan Carruthers-Smith
committer
GitHub
date
2 years ago
(Oct 19, 2023, 12:23 PM +0200)
commit
4f214152
4f214152eb5f0e4f144058a0ba377dcab8d71c9d
parent
d8bfea1e
d8bfea1efb13b4a5d6dd29582fda339c5dd875ab
+8
-4
2 changed files
Expand all
Collapse all
Unified
Split
contentprovider.go
eval.go
+3
-3
contentprovider.go
Reviewed
···
501
501
maxScore := &debugScore{}
502
502
503
503
addScore := func(what string, s float64) {
504
504
-
if debug {
504
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
571
-
maxScore.what = fmt.Sprintf("score:%f <- %s", maxScore.score, strings.TrimRight(maxScore.what, ", "))
571
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
587
-
if debug {
587
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
Reviewed
···
33
33
const maxUInt16 = 0xffff
34
34
35
35
func (m *FileMatch) addScore(what string, s float64, debugScore bool) {
36
36
-
if debugScore {
36
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
469
+
470
470
+
if opts.DebugScore {
471
471
+
fileMatch.Debug = strings.TrimSuffix(fileMatch.Debug, ", ")
472
472
+
}
469
473
}
470
474
471
475
// scoreFileUsingBM25 computes a score for the file match using an approximation to BM25, the most common scoring