Skip to content

Commit

Permalink
Remove redundant phrase boost logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Aug 5, 2024
1 parent acacc5e commit b4193c2
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 109 deletions.
6 changes: 1 addition & 5 deletions internal/e2e/e2e_rank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ func TestRanking(t *testing.T) {
t.Fatal(err)
}

// q is marshalled as part of the test, so avoid our rewrites for
// ranking.
qSearch := query.ExpirementalPhraseBoost(q, rq.Query, query.ExperimentalPhraseBoostOptions{})

sOpts := zoekt.SearchOptions{
// Use the same options sourcegraph has by default
ChunkMatches: true,
Expand All @@ -133,7 +129,7 @@ func TestRanking(t *testing.T) {

DebugScore: *debugScore,
}
result, err := ss.Search(context.Background(), qSearch, &sOpts)
result, err := ss.Search(context.Background(), q, &sOpts)
if err != nil {
t.Fatal(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ query: (and substr:"assets" substr:"are" substr:"not" substr:"configured" substr
targetRank: 1

**github.com/sourcegraph/sourcegraph/ui/assets/assets.go**
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")
33:func (p FailingAssetsProvider) Assets() http.FileSystem {
14: Assets() http.FileSystem
1:package assets
hidden 12 more line matches

github.com/sourcegraph/sourcegraph/schema/schema.go
Expand Down
50 changes: 25 additions & 25 deletions internal/e2e/testdata/generate_unit_test.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
queryString: generate unit test
query: (and substr:"generate" substr:"unit" substr:"test")
targetRank: 1

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

github.com/sourcegraph/sourcegraph/client/jetbrains/README.md
40:- Generate unit test
41:- Generate docstring
61:Cody is powered by Sourcegraph’s code graph and uses context of your codebase to extend its capabilities. By using context from entire repositories, Cody is able to give more accurate answers and generate idiomatic code.
hidden 7 more line matches

github.com/sourcegraph/cody/vscode/CHANGELOG.md
298:- The `/test` (Generate Unit Test) command was updated to use file dependencies and test examples when fetching context, in order to produce better results. To use this command, select code in your editor and run the `/test` command. It is recommended to set up test files before running the command to get optimal results. [pull/683](https://github.com/sourcegraph/cody/pull/683) [pull/602](https://github.com/sourcegraph/cody/pull/602)
218:- The `Generate Unit Tests` command has been improved with an enhanced context fetching process that produces test results with better quality. [pull/907](https://github.com/sourcegraph/cody/pull/907)
264:- The `Generate Unit Tests` command has been improved with an enhanced context fetching process that produces test results with better quality. [pull/907](https://github.com/sourcegraph/cody/pull/907)
hidden 17 more line matches

github.com/sourcegraph/sourcegraph/doc/cody/overview/install-jetbrains.md
158:- Generate unit test
138:Log in to your Sourcegraph instance and go to `settings` / `access token` (`https://<your-instance>.sourcegraph.com/users/<your-instance>/settings/tokens`). From here, generate a new access token.
159:- Generate docstring
hidden 3 more line matches
targetRank: 11

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) {
Expand All @@ -38,4 +14,28 @@ github.com/golang/go/src/cmd/vendor/github.com/google/pprof/internal/report/repo
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) {
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/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 245 more file matches
6 changes: 3 additions & 3 deletions internal/e2e/testdata/rank_stats.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
queries: 15
recall@1: 10 (67%)
recall@5: 12 (80%)
mrr: 0.730017
recall@1: 8 (53%)
recall@5: 10 (67%)
mrr: 0.607506
13 changes: 7 additions & 6 deletions internal/e2e/testdata/sourcegraphserver_docker_image_build.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
queryString: sourcegraph/server docker image build
query: (and substr:"sourcegraph/server" substr:"docker" substr:"image" substr:"build")
targetRank: 1

**github.com/sourcegraph/sourcegraph/dev/tools.go**
7: // zoekt-* used in sourcegraph/server docker image build
1://go:build tools
2:// +build tools
targetRank: 14

github.com/sourcegraph/sourcegraph/dev/sg/internal/images/images.go
458: Build int
Expand Down Expand Up @@ -37,4 +32,10 @@ github.com/sourcegraph/sourcegraph/internal/updatecheck/handler.go
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
238:### File system performance on Docker for Mac
hidden 52 more line matches

hidden 15 more file matches
61 changes: 0 additions & 61 deletions query/boost.go

This file was deleted.

7 changes: 0 additions & 7 deletions web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,6 @@ func (s *Server) serveSearchErr(r *http.Request) (*ApiSearchResult, error) {
return nil, err
}

// Experimental: The query string and boost exact phrases of it.
if phraseBoost, err := strconv.ParseFloat(qvals.Get("phrase-boost"), 64); err == nil {
q = query.ExpirementalPhraseBoost(q, queryStr, query.ExperimentalPhraseBoostOptions{
Boost: phraseBoost,
})
}

repoOnly := true
query.VisitAtoms(q, func(q query.Q) {
_, ok := q.(*query.Repo)
Expand Down

0 comments on commit b4193c2

Please sign in to comment.