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

Configure Feed

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

Add more debug info for keyword scoring (#592)

This expands the debug output for keyword scoring to include the main elements of the score. This will help debug some surprising behavior where scores are quite different on dot com vs. S2.

+10 -1
+10 -1
eval.go
··· 38 38 m.Score += s 39 39 } 40 40 41 + func (m *FileMatch) addKeywordScore(score float64, sumTf float64, L float64, debugScore bool) { 42 + if debugScore { 43 + m.Debug += fmt.Sprintf("keyword-score:%.2f (sum-tf: %.2f, length-ratio: %.2f)", score, sumTf, L) 44 + } 45 + m.Score += score 46 + } 47 + 41 48 // simplifyMultiRepo takes a query and a predicate. It returns Const(true) if all 42 49 // repository names fulfill the predicate, Const(false) if none of them do, and q 43 50 // otherwise. ··· 480 487 481 488 // Use standard parameter defaults (used in Lucene and academic papers) 482 489 k, b := 1.2, 0.75 490 + sumTf := 0.0 // Just for debugging 483 491 score := 0.0 484 492 for _, freq := range termFreqs { 485 493 tf := float64(freq) 494 + sumTf += tf 486 495 score += ((k + 1.0) * tf) / (k * (1.0 - b + b * L) + tf) 487 496 } 488 497 489 - fileMatch.addScore("keyword-score", score, opts.DebugScore) 498 + fileMatch.addKeywordScore(score, sumTf, L, opts.DebugScore) 490 499 } 491 500 492 501 func addRepo(res *SearchResult, repo *Repository) {