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

Configure Feed

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

ranking: boost camelCase (#472)

With this change we recognize changes in capitalization as word boundaries.

There is a corner case which was caught in the tests, where we falsy
classify "nnerClass" as word, because the preceeding letter in the code
is a capital "I". However, I don't believe this corner case is relevant
in practive and by accepting it we keep the code simple.

+20 -8
+11 -7
bits.go
··· 150 150 } 151 151 152 152 const ( 153 - _classChar = 0 154 - _classDigit = iota 155 - _classPunct = iota 156 - _classOther = iota 157 - _classSpace = iota 153 + _classLowerChar int = iota 154 + _classUpperChar 155 + _classDigit 156 + _classPunct 157 + _classOther 158 + _classSpace 158 159 ) 159 160 160 161 func byteClass(c byte) int { 161 - if (c >= 'a' && c <= 'z') || c >= 'A' && c <= 'Z' { 162 - return _classChar 162 + if c >= 'a' && c <= 'z' { 163 + return _classLowerChar 164 + } 165 + if c >= 'A' && c <= 'Z' { 166 + return _classUpperChar 163 167 } 164 168 if c >= '0' && c <= '9' { 165 169 return _classDigit
+9 -1
build/e2e_test.go
··· 878 878 { 879 879 fileName: "example.java", 880 880 content: exampleJava, 881 - query: &query.Substring{Content: true, Pattern: "nnerClass"}, 881 + query: &query.Substring{Content: true, Pattern: "nerClass"}, 882 882 wantLanguage: "Java", 883 883 // 5500 (partial symbol at boundary) + 1000 (Java class) + 50 (partial word) + 400 (atom) + 10 (file order) 884 884 wantScore: 6960, 885 + }, 886 + { 887 + fileName: "example.java", 888 + content: exampleJava, 889 + query: &query.Substring{Content: true, Pattern: "StaticClass"}, 890 + wantLanguage: "Java", 891 + // 5500 (partial symbol at boundary) + 1000 (Java class) + 500 (word) + 400 (atom) + 10 (file order) 892 + wantScore: 7410, 885 893 }, 886 894 { 887 895 fileName: "example.java",