Skip to content

Commit

Permalink
scoring: handle scip-ctags kinds
Browse files Browse the repository at this point in the history
There are likely more that we are missing. We only briefly looked at
golang, likely other languages are also affected. The regression is
scip-ctags returning different values for kind.

Will follow-up with a more comprehensive workaround until scip-ctags
issues are resolved.

Test Plan: manually tested queries like "test server" against the golang
repo until the test server struct was the top result.

Co-authored-by: Stefan Hengl <[email protected]>
  • Loading branch information
keegancsmith and stefanhengl committed Oct 17, 2023
1 parent 659eac9 commit 4fc31b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contentprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ func scoreKind(language string, kind string) float64 {

// Generic ranking which will be overriden by language specific ranking
switch kind {
case "type": // scip-ctags regression workaround https://github.com/sourcegraph/sourcegraph/issues/57659
factor = 8
case "class":
factor = 10
case "struct":
Expand Down Expand Up @@ -721,6 +723,8 @@ func scoreKind(language string, kind string) float64 {
}
case "Go", "go":
switch kind {
case "type": // scip-ctags regression workaround https://github.com/sourcegraph/sourcegraph/issues/57659
factor = 10
case "interface": // interfaces
factor = 10
case "struct": // structs
Expand All @@ -729,7 +733,7 @@ func scoreKind(language string, kind string) float64 {
factor = 9
case "methodSpec": // interface method specification
factor = 8.5
case "func": // functions
case "function", "func": // functions
factor = 8
case "member": // struct members
factor = 7
Expand Down

0 comments on commit 4fc31b6

Please sign in to comment.