From 4fc31b60b6707c07ec183ea1a227c8eb30df4890 Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Tue, 17 Oct 2023 11:55:50 +0200 Subject: [PATCH] scoring: handle scip-ctags kinds 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 --- contentprovider.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contentprovider.go b/contentprovider.go index 5f0860ae4..dbea207f8 100644 --- a/contentprovider.go +++ b/contentprovider.go @@ -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": @@ -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 @@ -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