From d32a823942f6f57b0989729d8fb45dc8adb1c37c Mon Sep 17 00:00:00 2001 From: Keegan Carruthers-Smith Date: Thu, 11 Jan 2024 21:41:38 +0200 Subject: [PATCH] WIP boost scores based on atoms Early preview of this work. I am playing around with factors/etc. Also only works for ChunkMatches at the moment. Some things it makes worse. For the atom boost queries we added, it improves all of those. --- api_test.go | 2 +- contentprovider.go | 51 ++++++++++++++- eval.go | 23 +++++-- .../Repository_metadata_Write_rbac.txt | 20 +++--- ...ets_are_not_configured_for_this_binary.txt | 8 +-- internal/e2e/testdata/bufio_buffer.txt | 10 ++- internal/e2e/testdata/bufio_flush_writer.txt | 56 ++++++++--------- internal/e2e/testdata/bytes_buffer.txt | 62 +++++++++---------- .../e2e/testdata/coverage_data_writer.txt | 34 +++++----- internal/e2e/testdata/generate_unit_test.txt | 26 ++++---- internal/e2e/testdata/graphql_type_User.txt | 16 ++--- .../e2e/testdata/r_cody_sourcegraph_url.txt | 20 +++--- internal/e2e/testdata/rank_stats.txt | 4 +- .../sourcegraphserver_docker_image_build.txt | 16 ++--- internal/e2e/testdata/test_server.txt | 28 ++++----- matchiter.go | 4 ++ 16 files changed, 221 insertions(+), 159 deletions(-) diff --git a/api_test.go b/api_test.go index fe860d58..7ea03458 100644 --- a/api_test.go +++ b/api_test.go @@ -150,7 +150,7 @@ func TestMatchSize(t *testing.T) { size: 112, }, { v: candidateMatch{}, - size: 72, + size: 80, }, { v: candidateChunk{}, size: 40, diff --git a/contentprovider.go b/contentprovider.go index 89ddebbb..f79b4996 100644 --- a/contentprovider.go +++ b/contentprovider.go @@ -18,6 +18,7 @@ import ( "bytes" "fmt" "log" + "math/bits" "os" "path" "sort" @@ -205,12 +206,14 @@ func (p *contentProvider) fillChunkMatches(ms []*candidateMatch, numContextLines FileName: true, }} } else { - result = p.fillContentChunkMatches(ms, numContextLines) + result = p.fillContentChunkMatches(ms, numContextLines, debug) } sects := p.docSections() for i, m := range result { - result[i].Score, result[i].DebugScore = p.chunkMatchScore(sects, &m, language, debug) + score, debugScore := p.chunkMatchScore(sects, &m, language, debug) + result[i].Score += score + result[i].DebugScore += debugScore } return result @@ -294,13 +297,48 @@ func (p *contentProvider) fillContentMatches(ms []*candidateMatch, numContextLin return result } -func (p *contentProvider) fillContentChunkMatches(ms []*candidateMatch, numContextLines int) []ChunkMatch { +func scoreQueryAtoms(ms []*candidateMatch, debug bool) (score float64, what string) { + queryAtoms := uint64(0) + + last := uint64(0) + run := 0 + maxRun := 0 + for _, cm := range ms { + queryAtoms = queryAtoms | cm.queryAtoms + + // TODO handle multiple bits set in cm.queryAtoms. only happens for linematch + if last < cm.queryAtoms { + run++ + if run > maxRun { + maxRun = run + } + } else if last > cm.queryAtoms { + run = 1 + } + last = cm.queryAtoms + } + + scoreCount := float64(bits.OnesCount64(queryAtoms)) * scoreQueryAtomsCountFactor + scoreRun := float64(maxRun) * scoreQueryAtomsRunFactor + + if debug && scoreCount > 0 { + what += fmt.Sprintf("%s:%.2f, ", "queryAtomsCount", scoreCount) + } + if debug && scoreRun > 0 { + what += fmt.Sprintf("%s:%.2f, ", "queryAtomsRun", scoreRun) + } + + return scoreCount + scoreRun, what +} + +func (p *contentProvider) fillContentChunkMatches(ms []*candidateMatch, numContextLines int, debug bool) []ChunkMatch { newlines := p.newlines() data := p.data(false) // columnHelper prevents O(len(ms) * len(data)) lookups for all columns. // However, it depends on ms being sorted by byteOffset and non-overlapping. // This invariant is true at the time of writing, but we conservatively + // enforce this. Note: chunkCandidates preserves the sorting so safe to // transform now. columnHelper := columnHelper{data: data} @@ -353,6 +391,8 @@ func (p *contentProvider) fillContentChunkMatches(ms []*candidateMatch, numConte } firstLineStart, _ := newlines.lineBounds(firstLineNumber) + initialScore, initialWhat := scoreQueryAtoms(chunk.candidates, debug) + chunkMatches = append(chunkMatches, ChunkMatch{ Content: newlines.getLines(data, firstLineNumber, int(chunk.lastLine)+numContextLines+1), ContentStart: Location{ @@ -363,6 +403,8 @@ func (p *contentProvider) fillContentChunkMatches(ms []*candidateMatch, numConte FileName: false, Ranges: ranges, SymbolInfo: symbolInfo, + Score: initialScore, + DebugScore: initialWhat, }) } return chunkMatches @@ -545,6 +587,9 @@ const ( // Used for ordering line and chunk matches within a file. scoreLineOrderFactor = 1.0 + + scoreQueryAtomsCountFactor = 500.0 + scoreQueryAtomsRunFactor = 750.0 ) // findSection checks whether a section defined by offset and size lies within diff --git a/eval.go b/eval.go index 902d0618..035515b7 100644 --- a/eval.go +++ b/eval.go @@ -540,6 +540,19 @@ func (m sortByOffsetSlice) Less(i, j int) bool { return m[i].byteOffset < m[j].byteOffset } +func setQueryAtom(cands []*candidateMatch, queryAtom *uint64) []*candidateMatch { + v := *queryAtom + // go spec says high bits are discarded on <<, so once we have seen 64 atoms v will become 0. + if v == 0 { + return cands + } + for _, cm := range cands { + cm.queryAtoms = v + } + *queryAtom = v << 1 + return cands +} + // Gather matches from this document. This never returns a mixture of // filename/content matches: if there are content matches, all // filename matches are trimmed from the result. The matches are @@ -550,18 +563,19 @@ func (m sortByOffsetSlice) Less(i, j int) bool { // but adjacent matches will remain. func gatherMatches(mt matchTree, known map[matchTree]bool, merge bool) []*candidateMatch { var cands []*candidateMatch + queryAtom := uint64(1) visitMatches(mt, known, func(mt matchTree) { if smt, ok := mt.(*substrMatchTree); ok { - cands = append(cands, smt.current...) + cands = append(cands, setQueryAtom(smt.current, &queryAtom)...) } if rmt, ok := mt.(*regexpMatchTree); ok { - cands = append(cands, rmt.found...) + cands = append(cands, setQueryAtom(rmt.found, &queryAtom)...) } if rmt, ok := mt.(*wordMatchTree); ok { - cands = append(cands, rmt.found...) + cands = append(cands, setQueryAtom(rmt.found, &queryAtom)...) } if smt, ok := mt.(*symbolRegexpMatchTree); ok { - cands = append(cands, smt.found...) + cands = append(cands, setQueryAtom(smt.found, &queryAtom)...) } }) @@ -597,6 +611,7 @@ func gatherMatches(mt matchTree, known map[matchTree]bool, merge bool) []*candid if lastEnd >= c.byteOffset { if end > lastEnd { last.byteMatchSz = end - last.byteOffset + last.queryAtoms = last.queryAtoms | c.queryAtoms } continue } diff --git a/internal/e2e/testdata/Repository_metadata_Write_rbac.txt b/internal/e2e/testdata/Repository_metadata_Write_rbac.txt index ac0fff6c..0c8585fd 100644 --- a/internal/e2e/testdata/Repository_metadata_Write_rbac.txt +++ b/internal/e2e/testdata/Repository_metadata_Write_rbac.txt @@ -2,6 +2,12 @@ queryString: Repository metadata Write rbac query: (and case_substr:"Repository" substr:"metadata" case_substr:"Write" substr:"rbac") targetRank: -1 +github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metadata_test.go +26:func TestRepositoryMetadata(t *testing.T) { +241: require.Equal(t, err, &rbac.ErrNotAuthorized{Permission: string(rbac.RepoMetadataWritePermission)}) +254: require.Equal(t, err, &rbac.ErrNotAuthorized{Permission: string(rbac.RepoMetadataWritePermission)}) +hidden 25 more line matches + github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metadata.go 54:func (r *schemaResolver) AddRepoMetadata(ctx context.Context, args struct { 95:func (r *schemaResolver) UpdateRepoMetadata(ctx context.Context, args struct { @@ -10,8 +16,8 @@ hidden 30 more line matches github.com/sourcegraph/sourcegraph/client/web/src/repo/tree/TreePageContent.tsx 666:interface RepositoryContributorNodeProps extends QuerySpec { -10:import { RepoMetadata } from '@sourcegraph/branded' -16:import { RepositoryType, SearchPatternType, type TreeFields } from '@sourcegraph/shared/src/graphql-operations' +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 @@ -20,15 +26,9 @@ github.com/sourcegraph/sourcegraph/doc/admin/repo/metadata.md 8:### Repository owners hidden 14 more line matches -github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/repository_metadata_test.go -26:func TestRepositoryMetadata(t *testing.T) { -17: "github.com/sourcegraph/sourcegraph/internal/rbac" -23: rtypes "github.com/sourcegraph/sourcegraph/internal/rbac/types" -hidden 25 more line matches - github.com/sourcegraph/sourcegraph/client/web/src/repo/repoContainerRoutes.tsx 3:import { canWriteRepoMetadata } from '../util/rbac' -5:import { RepositoryChangelistPage } from './commit/RepositoryCommitPage' -9:const RepositoryCommitPage = lazyComponent(() => import('./commit/RepositoryCommitPage'), 'RepositoryCommitPage') +24:const RepositoryMetadataPage = lazyComponent(() => import('./RepoMetadataPage'), 'RepoMetadataPage') +70: render: context => , hidden 19 more line matches diff --git a/internal/e2e/testdata/assets_are_not_configured_for_this_binary.txt b/internal/e2e/testdata/assets_are_not_configured_for_this_binary.txt index a501118e..64694a16 100644 --- a/internal/e2e/testdata/assets_are_not_configured_for_this_binary.txt +++ b/internal/e2e/testdata/assets_are_not_configured_for_this_binary.txt @@ -4,8 +4,8 @@ targetRank: 1 **github.com/sourcegraph/sourcegraph/ui/assets/assets.go** 33:func (p FailingAssetsProvider) Assets() http.FileSystem { -14: Assets() http.FileSystem -1:package assets +30: return nil, errors.New("assets are not configured for this binary, please see ui/assets") +34: panic("assets are not configured for this binary, please see ui/assets") hidden 12 more line matches github.com/sourcegraph/sourcegraph/schema/schema.go @@ -23,7 +23,7 @@ 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 -18:As your codebase grows in complexity, the value of code search quickly increases. Sourcegraph may be a good fit for your team if: +123:**Forks** are included in the index, but they are subject to the same limitations as other repositories, so not all forks are indexed. hidden 66 more line matches github.com/sourcegraph/sourcegraph/doc/admin/executors/deploy_executors_terraform.md @@ -35,7 +35,7 @@ hidden 68 more line matches github.com/sourcegraph/sourcegraph/doc/dev/background-information/sg/reference.md 496:### sg lint format 505:### sg lint format -1: +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 hidden 3 more file matches diff --git a/internal/e2e/testdata/bufio_buffer.txt b/internal/e2e/testdata/bufio_buffer.txt index 1e76e9c4..0c9c476b 100644 --- a/internal/e2e/testdata/bufio_buffer.txt +++ b/internal/e2e/testdata/bufio_buffer.txt @@ -26,16 +26,14 @@ github.com/golang/go/src/cmd/doc/pkg.go 8: "bufio" hidden 8 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" + github.com/golang/go/src/net/http/h2_bundle.go 3716:type http2pipeBuffer interface { 1086:type http2dataBuffer struct { 3724:func (p *http2pipe) setBuffer(b http2pipeBuffer) { hidden 116 more line matches -github.com/golang/go/src/image/png/writer.go -36:type EncoderBuffer encoder -24: BufferPool EncoderBufferPool -30:type EncoderBufferPool interface { -hidden 18 more line matches - hidden 112 more file matches diff --git a/internal/e2e/testdata/bufio_flush_writer.txt b/internal/e2e/testdata/bufio_flush_writer.txt index 5091b9ec..408f46f3 100644 --- a/internal/e2e/testdata/bufio_flush_writer.txt +++ b/internal/e2e/testdata/bufio_flush_writer.txt @@ -1,41 +1,41 @@ queryString: bufio flush writer query: (and substr:"bufio" substr:"flush" substr:"writer") -targetRank: 25 +targetRank: 1 -github.com/golang/go/src/image/gif/writer.go -43:type writer interface { -77:func (b blockWriter) Flush() error { -123:func (e *encoder) flush() { -hidden 28 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 -github.com/golang/go/src/image/jpeg/writer.go -211:type writer interface { -231:func (e *encoder) flush() { -212: Flush() error -hidden 11 more line matches +github.com/golang/go/src/net/http/fcgi/fcgi.go +233: *bufio.Writer +231:type bufWriter struct { +252:type streamWriter struct { +hidden 17 more line matches -github.com/golang/go/src/compress/lzw/writer.go -15:type writer interface { -36:type Writer struct { -17: Flush() error -hidden 36 more line matches +github.com/golang/go/src/cmd/internal/bio/buf.go +24: *bufio.Writer +22:type Writer struct { +34: return &Writer{f: f, Writer: bufio.NewWriter(f)}, nil +hidden 13 more line matches + +github.com/golang/go/src/net/http/internal/chunked.go +240: *bufio.Writer +239:type FlushAfterChunkWriter struct { +196:type chunkedWriter struct { +hidden 25 more line matches github.com/golang/go/src/bufio/bufio.go -579:type Writer struct { 635:func (b *Writer) Flush() error { +579:type Writer struct { 836: *Writer hidden 72 more line matches -github.com/golang/go/src/archive/zip/writer.go -24:type Writer struct { -61:func (w *Writer) Flush() error { -607: io.Writer -hidden 55 more line matches - -github.com/golang/go/src/encoding/csv/writer.go -30:type Writer struct { -123:func (w *Writer) Flush() { -37:func NewWriter(w io.Writer) *Writer { -hidden 25 more line matches +github.com/golang/go/src/image/gif/writer.go +77:func (b blockWriter) Flush() error { +43:type writer interface { +123:func (e *encoder) flush() { +hidden 28 more line matches hidden 77 more file matches diff --git a/internal/e2e/testdata/bytes_buffer.txt b/internal/e2e/testdata/bytes_buffer.txt index dba9506a..8394a64e 100644 --- a/internal/e2e/testdata/bytes_buffer.txt +++ b/internal/e2e/testdata/bytes_buffer.txt @@ -1,41 +1,41 @@ queryString: bytes buffer query: (and substr:"bytes" substr:"buffer") -targetRank: 1 +targetRank: 5 -**github.com/golang/go/src/bytes/buffer.go** -20:type Buffer struct { -54:func (b *Buffer) Bytes() []byte { return b.buf[b.off:] } -5:package bytes -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/cmd/internal/edit/edit.go -14:type Buffer struct { -68:func (b *Buffer) Bytes() []byte { -41:func NewBuffer(data []byte) *Buffer { -hidden 13 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/hash/crc32/crc32_ppc64le.s -122: SLD $2,R8 // convert index-> bytes -59: MOVWZ 0(R5),R8 // 0-3 bytes of p ?Endian? -60: MOVWZ 4(R5),R9 // 4-7 bytes of p -hidden 35 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/fmt/print.go -101:type buffer []byte -509:func (p *pp) fmtBytes(v []byte, verb rune, typeString string) { -17:// Strings for use with buffer.WriteString. -hidden 28 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/bufio/scan.go -106:func (s *Scanner) Bytes() []byte { -267:func (s *Scanner) Buffer(buf []byte, max int) { -289:func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) { -hidden 26 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 { +5:package bytes +hidden 126 more line matches -github.com/golang/go/src/os/exec/exec.go -1134:func (w *prefixSuffixSaver) Bytes() []byte { -94: "bytes" -396: if i := bytes.Index(stack, []byte("\nos/exec.Command(")); i >= 0 { -hidden 17 more line matches +github.com/golang/go/src/cmd/doc/pkg.go +59: bytes.Buffer +56:type pkgBuffer struct { +233:var newlineBytes = []byte("\n\n") // We never ask for more than 2. +hidden 11 more line matches hidden 494 more file matches diff --git a/internal/e2e/testdata/coverage_data_writer.txt b/internal/e2e/testdata/coverage_data_writer.txt index a4a094f7..178a3cdf 100644 --- a/internal/e2e/testdata/coverage_data_writer.txt +++ b/internal/e2e/testdata/coverage_data_writer.txt @@ -1,17 +1,29 @@ queryString: coverage data writer query: (and substr:"coverage" substr:"data" substr:"writer") -targetRank: 13 +targetRank: 1 + +**github.com/golang/go/src/internal/coverage/encodecounter/encode.go** +26:type CoverageDataWriter struct { +36:func NewCoverageDataWriter(w io.Writer, flav coverage.CounterFlavor) *CoverageDataWriter { +37: r := &CoverageDataWriter{ +hidden 41 more line matches + +github.com/golang/go/src/runtime/coverage/emit.go +447:func writeMetaData(w io.Writer, metalist []rtcov.CovMetaBlob, cmode coverage.CounterMode, gran coverage.CounterGranularity, finalHash [16]byte) error { +341:func (s *emitState) emitCounterDataToWriter(w io.Writer) error { +5:package coverage +hidden 125 more line matches github.com/golang/go/src/internal/coverage/stringtab/stringtab.go 19:type Writer struct { 27:func (stw *Writer) InitWriter() { -9: "internal/coverage/slicereader" +15:// for use in emitting and reading/decoding coverage meta-data and hidden 16 more line matches github.com/golang/go/src/cmd/cover/func.go 149:func (f *FuncExtent) coverage(profile *cover.Profile) (num, den int64) { -30:// funcOutput takes two file names as arguments, a coverage profile to read as input and an output 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/cover/html.go @@ -22,20 +34,8 @@ hidden 18 more line matches github.com/golang/go/src/internal/fuzz/fuzz.go 474: Data []byte -487:func corpusEntryData(ce CorpusEntry) ([]byte, error) { -908:func (c *coordinator) updateCoverage(newCoverage []byte) int { +515: coverageData []byte +530: coverageData []byte hidden 91 more line matches -github.com/golang/go/src/testing/fuzz.go -93: Data []byte -205:// modify the underlying data of the arguments provided by the fuzzing engine. -275: run := func(captureOut io.Writer, e corpusEntry) (ok bool) { -hidden 7 more line matches - -github.com/golang/go/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go -227: Data [7]byte -449: Data [8]uint32 -2384: Data *byte -hidden 85 more line matches - hidden 35 more file matches diff --git a/internal/e2e/testdata/generate_unit_test.txt b/internal/e2e/testdata/generate_unit_test.txt index 8feb50b7..fa2d4067 100644 --- a/internal/e2e/testdata/generate_unit_test.txt +++ b/internal/e2e/testdata/generate_unit_test.txt @@ -1,6 +1,12 @@ queryString: generate unit test query: (and substr:"generate" substr:"unit" substr:"test") -targetRank: 11 +targetRank: 3 + +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 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) { @@ -8,18 +14,18 @@ github.com/sourcegraph/sourcegraph/cmd/frontend/internal/insights/resolvers/insi 286: generateResolver resolverGenerator hidden 16 more line matches +**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/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/sourcegraph/sourcegraph/internal/codeintel/autoindexing/internal/inference/lua/test.lua -9: generate = function(_, paths) -6: patterns = { pattern.new_path_basename "sg-test" }, -8: -- Invoked as part of unit tests for the autoindexing service -hidden 1 more line matches - github.com/golang/go/src/cmd/internal/testdir/testdir_test.go 273:type test struct { 74:func Test(t *testing.T) { @@ -32,10 +38,4 @@ github.com/golang/go/src/cmd/vendor/github.com/google/pprof/profile/profile.go 68: unitX int64 hidden 44 more line matches -github.com/golang/go/src/cmd/link/internal/loader/loader.go -79: unit *sym.CompilationUnit -1544:func (l *Loader) SymUnit(i Sym) *sym.CompilationUnit { -228: generatedSyms Bitmap // symbols that generate their content, indexed by ext sym idx -hidden 50 more line matches - hidden 244 more file matches diff --git a/internal/e2e/testdata/graphql_type_User.txt b/internal/e2e/testdata/graphql_type_User.txt index eee2f485..9a3218bb 100644 --- a/internal/e2e/testdata/graphql_type_User.txt +++ b/internal/e2e/testdata/graphql_type_User.txt @@ -4,8 +4,8 @@ targetRank: 1 **github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/schema.graphql** 6376:type User implements Node & SettingsSubject & Namespace { -3862: type: GitRefType -5037: type: GitRefType! +6337:type UserConnection { +6840:type UserEmail { hidden 460 more line matches github.com/sourcegraph/sourcegraph/internal/types/types.go @@ -14,12 +14,6 @@ github.com/sourcegraph/sourcegraph/internal/types/types.go 1766: Type string hidden 234 more line matches -github.com/sourcegraph/sourcegraph/client/web/src/enterprise/insights/core/backend/gql-backend/methods/get-dashboard-owners.ts -22: type: InsightsDashboardOwnerType.Global, -32: type: InsightsDashboardOwnerType.Personal, -18: const { currentUser, site } = data -hidden 8 more line matches - github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend/apitest/types.go 47:type User struct { 9: Typename string `json:"__typename"` @@ -38,4 +32,10 @@ github.com/sourcegraph/sourcegraph/internal/extsvc/github/common.go 527: Type string hidden 136 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 + hidden 494 more file matches diff --git a/internal/e2e/testdata/r_cody_sourcegraph_url.txt b/internal/e2e/testdata/r_cody_sourcegraph_url.txt index 66d658ac..74b3d1c6 100644 --- a/internal/e2e/testdata/r_cody_sourcegraph_url.txt +++ b/internal/e2e/testdata/r_cody_sourcegraph_url.txt @@ -25,16 +25,16 @@ github.com/sourcegraph/cody/slack/src/services/local-vector-store.ts 9: owner: 'sourcegraph', 24: fileName: url, -github.com/sourcegraph/cody/lib/shared/src/sourcegraph-api/completions/client.ts -23:export abstract class SourcegraphCompletionsClient { -21: * Access the chat based LLM APIs via a Sourcegraph server instance. -36: return new URL('/.api/completions/stream', this.config.serverEndpoint).href -hidden 1 more line matches +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/lib/shared/src/sourcegraph-api/completions/browserClient.ts -8:export class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient { -5:import { SourcegraphCompletionsClient } from './client' -20: headersInstance.set('X-Sourcegraph-Should-Trace', 'true') -hidden 1 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 hidden 71 more file matches diff --git a/internal/e2e/testdata/rank_stats.txt b/internal/e2e/testdata/rank_stats.txt index a7b18c58..f6135d93 100644 --- a/internal/e2e/testdata/rank_stats.txt +++ b/internal/e2e/testdata/rank_stats.txt @@ -1,4 +1,4 @@ queries: 13 recall@1: 6 (46%) -recall@5: 8 (62%) -mrr: 0.547123 +recall@5: 11 (85%) +mrr: 0.611538 diff --git a/internal/e2e/testdata/sourcegraphserver_docker_image_build.txt b/internal/e2e/testdata/sourcegraphserver_docker_image_build.txt index b1c431e9..cbb55525 100644 --- a/internal/e2e/testdata/sourcegraphserver_docker_image_build.txt +++ b/internal/e2e/testdata/sourcegraphserver_docker_image_build.txt @@ -1,11 +1,17 @@ queryString: sourcegraph/server docker image build query: (and substr:"sourcegraph/server" substr:"docker" substr:"image" substr:"build") -targetRank: 14 +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 { -352:type ErrNoImage struct { hidden 118 more line matches github.com/sourcegraph/sourcegraph/doc/admin/external_services/postgres.md @@ -26,12 +32,6 @@ github.com/sourcegraph/sourcegraph/schema/schema.go 2631: ExecutorsSrcCLIImage string `json:"executors.srcCLIImage,omitempty"` hidden 22 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/deploy/docker-single-container/index.md 1:# Docker Single Container Deployment 294:### Insiders build diff --git a/internal/e2e/testdata/test_server.txt b/internal/e2e/testdata/test_server.txt index 11464fec..8b8a681c 100644 --- a/internal/e2e/testdata/test_server.txt +++ b/internal/e2e/testdata/test_server.txt @@ -1,6 +1,12 @@ queryString: test server query: (and substr:"test" substr:"server") -targetRank: 1 +targetRank: 2 + +github.com/sourcegraph/sourcegraph/cmd/worker/internal/outboundwebhooks/handler_test.go +158: *httptest.Server +162:func newMockServer(t *testing.T, expectedPayload []byte, statusCode int) *mockServer { +157:type mockServer struct { +hidden 25 more line matches **github.com/golang/go/src/net/http/httptest/server.go** 26:type Server struct { @@ -8,22 +14,22 @@ targetRank: 1 117:func NewUnstartedServer(handler http.Handler) *Server { hidden 62 more line matches -github.com/golang/go/src/net/rpc/server.go -188:type Server struct { -656:type ServerCodec interface { -197:func NewServer() *Server { -hidden 104 more line matches - github.com/sourcegraph/cody/vscode/test/fixtures/mock-server.ts 126: const server = app.listen(SERVER_PORT, () => { 19:const SERVER_PORT = 49300 21:export const SERVER_URL = 'http://localhost:49300' hidden 24 more line matches +github.com/golang/go/src/net/rpc/server.go +188:type Server struct { +656:type ServerCodec interface { +197:func NewServer() *Server { +hidden 104 more line matches + github.com/golang/go/src/net/http/server.go 2617:type Server struct { 256: server *Server -2925:type serverHandler struct { +2988:var testHookServerServe func(*Server, net.Listener) // used if non-nil hidden 180 more line matches github.com/sourcegraph/sourcegraph/cmd/gitserver/server/server.go @@ -32,10 +38,4 @@ github.com/sourcegraph/sourcegraph/cmd/gitserver/server/server.go 741:func (s *Server) serverContext() (context.Context, context.CancelFunc) { hidden 166 more line matches -github.com/golang/go/src/cmd/go/internal/vcweb/vcstest/vcstest.go -32:type Server struct { -42:func NewServer() (srv *Server, err error) { -7:package vcstest -hidden 31 more line matches - hidden 494 more file matches diff --git a/matchiter.go b/matchiter.go index 68c6e485..5bd3a008 100644 --- a/matchiter.go +++ b/matchiter.go @@ -27,6 +27,10 @@ type candidateMatch struct { substrBytes []byte substrLowered []byte + // queryAtoms is a bitmask for which atoms in the query this candidate came + // from. + queryAtoms uint64 + file uint32 symbolIdx uint32