Skip to content

Commit

Permalink
take into account filename matches in scores
Browse files Browse the repository at this point in the history
  • Loading branch information
keegancsmith committed Jan 17, 2024
1 parent 5518a5a commit 6aa80e8
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 124 deletions.
5 changes: 3 additions & 2 deletions contentprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,9 @@ const (
// Used for ordering line and chunk matches within a file.
scoreLineOrderFactor = 1.0

scoreQueryAtomsCountFactor = 3000.0
scoreQueryAtomsRunFactor = 1000.0
scoreQueryContentAtomsCountFactor = 3000.0
scoreQueryContentAtomsRunFactor = 1000.0
scoreQueryFilenameAtomsCountFactor = 1000.0
)

// findSection checks whether a section defined by offset and size lies within
Expand Down
12 changes: 6 additions & 6 deletions internal/e2e/testdata/Repository_metadata_Write_rbac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metada
134:func (r *schemaResolver) DeleteRepoMetadata(ctx context.Context, args struct {
hidden 30 more line matches

github.com/sourcegraph/sourcegraph/client/web/src/repo/tree/TreePageContent.tsx
666:interface RepositoryContributorNodeProps extends QuerySpec {
53:import { canWriteRepoMetadata } from '../../util/rbac'
213: const [enableRepositoryMetadata] = useFeatureFlag('repository-metadata', true)
hidden 46 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/repo/metadata.md
1:# Custom repository metadata
18:## Adding metadata
8:### Repository owners
hidden 14 more line matches

github.com/sourcegraph/sourcegraph/client/web/src/repo/tree/TreePageContent.tsx
666:interface RepositoryContributorNodeProps extends QuerySpec {
53:import { canWriteRepoMetadata } from '../../util/rbac'
213: const [enableRepositoryMetadata] = useFeatureFlag('repository-metadata', true)
hidden 46 more line matches

github.com/sourcegraph/sourcegraph/client/web/src/repo/repoContainerRoutes.tsx
3:import { canWriteRepoMetadata } from '../util/rbac'
24:const RepositoryMetadataPage = lazyComponent(() => import('./RepoMetadataPage'), 'RepoMetadataPage')
Expand Down
24 changes: 12 additions & 12 deletions internal/e2e/testdata/assets_are_not_configured_for_this_binary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ github.com/sourcegraph/sourcegraph/schema/schema.go
1538:type Notifications struct {
hidden 668 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/executors/deploy_executors.md
118:## Confirm executors are working
194:### Configuring the auth config for use in executors
216:### Adding certificates to a binary deployment
hidden 47 more line matches

github.com/sourcegraph/sourcegraph/doc/getting-started/github-vs-sourcegraph.md
8:## Which is best for you?
110:### Searching repositories, branches, and forks
28:For a high-level overview of how Sourcegraph compares to GitHub code search, see this [document](https://storage.googleapis.com/sourcegraph-assets/docs/PDFs/Sourcegraph%20vs.%20GitHub%20code%20search%20chart.pdf).
hidden 66 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/executors/deploy_executors_terraform.md
1:# Deploying Sourcegraph executors using Terraform on AWS or GCP
56:## Terraform Version
Expand All @@ -38,4 +26,16 @@ github.com/sourcegraph/sourcegraph/doc/dev/background-information/sg/reference.m
726:* `--skip-upgrade-validation`: Do not attempt to compare the previous instance version with the target instance version for upgrade compatibility. Please refer to https://docs.sourcegraph.com/admin/updates#update-policy for our instance upgrade compatibility policy.
hidden 265 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/executors/deploy_executors.md
118:## Confirm executors are working
194:### Configuring the auth config for use in executors
216:### Adding certificates to a binary deployment
hidden 47 more line matches

github.com/sourcegraph/sourcegraph/doc/getting-started/github-vs-sourcegraph.md
8:## Which is best for you?
110:### Searching repositories, branches, and forks
28:For a high-level overview of how Sourcegraph compares to GitHub code search, see this [document](https://storage.googleapis.com/sourcegraph-assets/docs/PDFs/Sourcegraph%20vs.%20GitHub%20code%20search%20chart.pdf).
hidden 66 more line matches

hidden 3 more file matches
22 changes: 11 additions & 11 deletions internal/e2e/testdata/bufio_buffer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ hidden 108 more line matches
25:// large to fit in the buffer. When a scan stops, the reader may have
hidden 21 more line matches

github.com/golang/go/src/bufio/bufio.go
8:package bufio
25: ErrBufferFull = errors.New("bufio: buffer full")
665:func (b *Writer) AvailableBuffer() []byte {
hidden 89 more line matches

github.com/golang/go/test/fixedbugs/issue5089.go
13:func (b *bufio.Reader) Buffered() int { // ERROR "non-local|redefinition"
11:import "bufio"
Expand All @@ -24,16 +30,10 @@ github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer/writer.go
36:const writerBufferSize = 4096
hidden 8 more line matches

github.com/golang/go/src/bufio/bufio.go
8:package bufio
25: ErrBufferFull = errors.New("bufio: buffer full")
665:func (b *Writer) AvailableBuffer() []byte {
hidden 89 more line matches

github.com/golang/go/src/cmd/doc/pkg.go
59: bytes.Buffer
56:type pkgBuffer struct {
8: "bufio"
hidden 8 more line matches
github.com/golang/go/src/bufio/scan_test.go
526:func TestHugeBuffer(t *testing.T) {
5:package bufio_test
8: . "bufio"
hidden 9 more line matches

hidden 112 more file matches
14 changes: 7 additions & 7 deletions internal/e2e/testdata/bufio_flush_writer.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
queryString: bufio flush writer
query: (and substr:"bufio" substr:"flush" substr:"writer")
targetRank: 1

**github.com/golang/go/src/net/http/transfer.go**
1113:type bufioFlushWriter struct{ w io.Writer }
59:type transferWriter struct {
76:func newTransferWriter(r any) (t *transferWriter, err error) {
hidden 36 more line matches
targetRank: 6

github.com/golang/go/src/bufio/bufio.go
635:func (b *Writer) Flush() error {
Expand Down Expand Up @@ -38,4 +32,10 @@ github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer/writer.go
20: Flush() error
hidden 18 more line matches

**github.com/golang/go/src/net/http/transfer.go**
1113:type bufioFlushWriter struct{ w io.Writer }
59:type transferWriter struct {
76:func newTransferWriter(r any) (t *transferWriter, err error) {
hidden 36 more line matches

hidden 77 more file matches
26 changes: 13 additions & 13 deletions internal/e2e/testdata/bytes_buffer.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
queryString: bytes buffer
query: (and substr:"bytes" substr:"buffer")
targetRank: 5
targetRank: 1

**github.com/golang/go/src/bytes/buffer.go**
54:func (b *Buffer) Bytes() []byte { return b.buf[b.off:] }
20:type Buffer struct {
430:func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
hidden 126 more line matches

github.com/sourcegraph/sourcegraph/lib/output/block.go
49: buffer bytes.Buffer
41: for _, line := range bytes.Split(bytes.TrimRight(b.writer.buffer.Bytes(), "\n"), []byte("\n")) {
4: "bytes"
hidden 2 more line matches

github.com/golang/go/src/compress/flate/huffman_bit_writer.go
82: bytes [bufferSize]byte
166:func (w *huffmanBitWriter) writeBytes(bytes []byte) {
29: bufferFlushSize = 240
hidden 63 more line matches

github.com/sourcegraph/sourcegraph/client/browser/src/types/webextension-polyfill/index.d.ts
1708: bytes?: ArrayBuffer
501: bytesReceived: number
502: totalBytes: number
hidden 9 more line matches

github.com/golang/go/src/compress/flate/huffman_bit_writer.go
82: bytes [bufferSize]byte
166:func (w *huffmanBitWriter) writeBytes(bytes []byte) {
29: bufferFlushSize = 240
hidden 63 more line matches

github.com/golang/go/src/encoding/json/decode_test.go
1784: Buffer bytes.Buffer
1777: PBuffer *bytes.Buffer // has methods, just not relevant ones
1379: ByteSlice []byte
hidden 17 more line matches

**github.com/golang/go/src/bytes/buffer.go**
54:func (b *Buffer) Bytes() []byte { return b.buf[b.off:] }
20:type Buffer struct {
430:func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
hidden 126 more line matches

github.com/golang/go/src/encoding/gob/decode.go
74:func (d *decBuffer) Bytes() []byte {
79:func (d *decBuffer) SetBytes(data []byte) {
Expand Down
10 changes: 5 additions & 5 deletions internal/e2e/testdata/coverage_data_writer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ github.com/golang/go/src/internal/coverage/encodemeta/encodefile.go
32: r := &CoverageMetaFileWriter{
hidden 14 more line matches

github.com/golang/go/src/cmd/cover/func.go
149:func (f *FuncExtent) coverage(profile *cover.Profile) (num, den int64) {
32:// as output the coverage data broken down by function, like this:
30:// funcOutput takes two file names as arguments, a coverage profile to read as input and an output
hidden 8 more line matches
github.com/golang/go/src/cmd/link/internal/ld/data.go
1522: data [sym.SXREF][]loader.Sym
1524: dataMaxAlign [sym.SXREF]int32
1196:func addstrdata(arch *sys.Arch, l *loader.Loader, name, value string) {
hidden 334 more line matches

hidden 35 more file matches
48 changes: 24 additions & 24 deletions internal/e2e/testdata/generate_unit_test.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
queryString: generate unit test
query: (and substr:"generate" substr:"unit" substr:"test")
targetRank: 2

github.com/sourcegraph/sourcegraph/doc/cody/quickstart.md
72:## 1. Generate a unit test
5:1. Try the `Generate Unit Tests` command
74:To ensure code quality and early bug detection, one of the most useful commands that Cody offers is `Generate Unit Tests`. It quickly helps you write a test code for any snippet that you have highlighted. To generate a unit test for our example function:
hidden 12 more line matches
targetRank: 1

**github.com/sourcegraph/cody/lib/shared/src/chat/recipes/generate-test.ts**
14:export class GenerateTest implements Recipe {
15: public id: RecipeID = 'generate-unit-test'
16: public title = 'Generate Unit Test'
hidden 3 more line matches

github.com/sourcegraph/sourcegraph/cmd/frontend/internal/insights/resolvers/insight_series_resolver.go
300:func (j *seriesResolverGenerator) Generate(ctx context.Context, series types.InsightViewSeries, baseResolver baseInsightResolver, filters types.InsightViewFilters, options types.SeriesDisplayOptions) ([]graphqlbackend.InsightSeriesResolver, error) {
275: Generate(ctx context.Context, series types.InsightViewSeries, baseResolver baseInsightResolver, filters types.InsightViewFilters, options types.SeriesDisplayOptions) ([]graphqlbackend.InsightSeriesResolver, error)
286: generateResolver resolverGenerator
hidden 16 more line matches

github.com/golang/go/src/cmd/vendor/github.com/google/pprof/internal/report/report.go
87:func Generate(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
187:func (rpt *Report) selectOutputUnit(g *graph.Graph) {
75: SampleUnit string // Unit for the sample data from the profile.
hidden 48 more line matches

github.com/golang/go/src/cmd/internal/testdir/testdir_test.go
273:type test struct {
74:func Test(t *testing.T) {
263:type testCommon struct {
hidden 120 more line matches

github.com/golang/go/src/cmd/vendor/github.com/google/pprof/profile/profile.go
65: Unit string // seconds, nanoseconds, bytes, etc
77: NumUnit map[string][]string
68: unitX int64
hidden 44 more line matches
github.com/sourcegraph/sourcegraph/internal/codeintel/autoindexing/internal/inference/lua/test.lua
9: generate = function(_, paths)
8: -- Invoked as part of unit tests for the autoindexing service
6: patterns = { pattern.new_path_basename "sg-test" },
hidden 1 more line matches

github.com/golang/go/src/runtime/mgcpacer_test.go
891:func unit(amp float64) float64Stream {
760:type gcExecTest struct {
16:func TestGcPacer(t *testing.T) {
hidden 72 more line matches

github.com/golang/go/src/debug/dwarf/entry_test.go
284:func TestUnitIteration(t *testing.T) {
15:func TestSplit(t *testing.T) {
48:func TestReaderSeek(t *testing.T) {
hidden 60 more line matches

github.com/sourcegraph/sourcegraph/internal/license/license_test.go
75:func TestGenerateParseSignedKey(t *testing.T) {
11:func TestParseTagsInput(t *testing.T) {
32:func TestInfo_EncodeDecode(t *testing.T) {
hidden 21 more line matches

hidden 244 more file matches
20 changes: 10 additions & 10 deletions internal/e2e/testdata/graphql_type_User.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ github.com/sourcegraph/sourcegraph/cmd/frontend/internal/batches/resolvers/apite
364: User *User
hidden 68 more line matches

github.com/sourcegraph/sourcegraph/internal/extsvc/github/common.go
2030:type User struct {
2036:type UserEmail struct {
66: User *Actor `json:"User,omitempty"`
hidden 136 more line matches
github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/user.go
239: User graphql.ID
643: User graphql.ID
681: User graphql.ID
hidden 166 more line matches

github.com/sourcegraph/sourcegraph/cmd/frontend/internal/authz/resolvers/permissions_info.go
238:func (r permissionsInfoUserResolver) User(ctx context.Context) *graphqlbackend.UserResolver {
171:func (r *permissionsInfoResolver) Users(ctx context.Context, args graphqlbackend.PermissionsInfoUsersArgs) (*graphqlutil.ConnectionResolver[graphqlbackend.PermissionsInfoUserResolver], error) {
229:type permissionsInfoUserResolver struct {
hidden 38 more line matches
github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/rbac.go
49: User *graphql.ID
56: User *graphql.ID
65: User graphql.ID
hidden 24 more line matches

hidden 494 more file matches
26 changes: 13 additions & 13 deletions internal/e2e/testdata/r_cody_sourcegraph_url.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
queryString: r:cody sourcegraph url
query: (and repo:cody substr:"sourcegraph" substr:"url")
targetRank: 6
targetRank: 4

github.com/sourcegraph/cody/e2e/src/sourcegraph-api.ts
41: const sourcegraphApiUrl = `${sourcegraphEndpoint}/.api/graphql`
3:const SOURCEGRAPH_GRAPHQL_SEARCH_QUERY = `
40: const sourcegraphEndpoint = process.env.SRC_ENDPOINT ?? ''
hidden 5 more line matches

github.com/sourcegraph/cody/vscode/src/chat/chat-view/ChatPanelProvider.ts
303: const sourcegraphSearchURL = new URL(
307: void this.openExternalLinks(sourcegraphSearchURL)
3:import { CodyPrompt, CustomCommandType } from '@sourcegraph/cody-shared/src/chat/prompts'
hidden 4 more line matches

github.com/sourcegraph/cody/vscode/src/chat/chat-view/SidebarChatProvider.ts
423: const sourcegraphSearchURL = new URL(
195: const DOWNLOAD_URL =
427: void this.openExternalLinks(sourcegraphSearchURL)
hidden 14 more line matches

github.com/sourcegraph/cody/lib/shared/src/sourcegraph-api/graphql/url.ts
7: baseUrl: string
12:export const buildGraphQLUrl = ({ request, baseUrl }: BuildGraphQLUrlOptions): string => {
Expand All @@ -38,4 +26,16 @@ hidden 6 more line matches
641: const url = 'http://localhost:49300/.api/testLogging'
hidden 51 more line matches

github.com/sourcegraph/cody/vscode/src/chat/chat-view/ChatPanelProvider.ts
303: const sourcegraphSearchURL = new URL(
307: void this.openExternalLinks(sourcegraphSearchURL)
3:import { CodyPrompt, CustomCommandType } from '@sourcegraph/cody-shared/src/chat/prompts'
hidden 4 more line matches

github.com/sourcegraph/cody/vscode/src/chat/chat-view/SidebarChatProvider.ts
423: const sourcegraphSearchURL = new URL(
195: const DOWNLOAD_URL =
427: void this.openExternalLinks(sourcegraphSearchURL)
hidden 14 more line matches

hidden 71 more file matches
4 changes: 2 additions & 2 deletions internal/e2e/testdata/rank_stats.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
queries: 13
recall@1: 4 (31%)
recall@1: 5 (38%)
recall@5: 9 (69%)
mrr: 0.484271
mrr: 0.526579
24 changes: 12 additions & 12 deletions internal/e2e/testdata/sourcegraphserver_docker_image_build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@ queryString: sourcegraph/server docker image build
query: (and substr:"sourcegraph/server" substr:"docker" substr:"image" substr:"build")
targetRank: 12

github.com/sourcegraph/sourcegraph/internal/updatecheck/handler.go
40: latestReleaseDockerServerImageBuild = newPingResponse("5.1.8")
45: latestReleaseKubernetesBuild = newPingResponse("5.1.8")
50: latestReleaseDockerComposeOrPureDocker = newPingResponse("5.1.8")
hidden 19 more line matches

github.com/sourcegraph/sourcegraph/dev/sg/internal/images/images.go
458: Build int
545:const dockerImageTagsURL = "https://index.docker.io/v2/%s/tags/list"
234:type ImageReference struct {
hidden 118 more line matches

github.com/sourcegraph/sourcegraph/internal/updatecheck/handler.go
40: latestReleaseDockerServerImageBuild = newPingResponse("5.1.8")
45: latestReleaseKubernetesBuild = newPingResponse("5.1.8")
50: latestReleaseDockerComposeOrPureDocker = newPingResponse("5.1.8")
hidden 19 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/external_services/postgres.md
41:### sourcegraph/server
192:### sourcegraph/server
53:### Docker Compose
hidden 19 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/deploy/docker-single-container/index.md
1:# Docker Single Container Deployment
294:### Insiders build
238:### File system performance on Docker for Mac
hidden 52 more line matches

github.com/sourcegraph/sourcegraph/internal/conf/deploy/deploytype.go
66:func IsDeployTypePureDocker(deployType string) bool {
12: SingleDocker = "docker-container"
Expand All @@ -32,10 +38,4 @@ github.com/sourcegraph/sourcegraph/schema/schema.go
2631: ExecutorsSrcCLIImage string `json:"executors.srcCLIImage,omitempty"`
hidden 22 more line matches

github.com/sourcegraph/sourcegraph/doc/admin/deploy/docker-single-container/index.md
1:# Docker Single Container Deployment
294:### Insiders build
238:### File system performance on Docker for Mac
hidden 52 more line matches

hidden 15 more file matches
Loading

0 comments on commit 6aa80e8

Please sign in to comment.