Skip to content

Commit f9632c4

Browse files
authored
search: rename result type fields consistently (#610)
1 parent 2b0cf46 commit f9632c4

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

cmd/src/search_stream_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var event = []streaming.EventMatch{
4242
Path: "path/to/file",
4343
Repository: "org/repo",
4444
Branches: nil,
45-
Version: "",
45+
Commit: "",
4646
LineMatches: []streaming.EventLineMatch{
4747
{
4848
Line: "foo bar foo",
@@ -61,7 +61,7 @@ var event = []streaming.EventMatch{
6161
Path: "path/to/file",
6262
Repository: "org/repo",
6363
Branches: []string{},
64-
Version: "",
64+
Commit: "",
6565
Symbols: []streaming.Symbol{
6666
{
6767
URL: "github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/search_results.go#L1591:26-1591:35",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{"type":"content","name":"path/to/file","repository":"org/repo","lineMatches":[{"line":"foo bar foo","lineNumber":4,"offsetAndLengths":[[0,3],[8,3]]}]}
1+
{"type":"content","path":"path/to/file","repository":"org/repo","lineMatches":[{"line":"foo bar foo","lineNumber":4,"offsetAndLengths":[[0,3],[8,3]]}]}
22
{"type":"repo","repository":"sourcegraph/sourcegraph"}
3-
{"type":"symbol","name":"path/to/file","repository":"org/repo","symbols":[{"url":"github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/search_results.go#L1591:26-1591:35","name":"doResults","containerName":"","kind":"FUNCTION"},{"url":"github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/search_results.go#L1591:26-1591:35","name":"Results","containerName":"SearchResultsResolver","kind":"FIELD"}]}
3+
{"type":"symbol","path":"path/to/file","repository":"org/repo","symbols":[{"url":"github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/search_results.go#L1591:26-1591:35","name":"doResults","containerName":"","kind":"FUNCTION"},{"url":"github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/search_results.go#L1591:26-1591:35","name":"Results","containerName":"SearchResultsResolver","kind":"FIELD"}]}
44
{"type":"commit","icon":"","label":"[sourcegraph/sourcegraph-atom](/github.com/sourcegraph/sourcegraph-atom) › [Stephen Gutekanst](/github.com/sourcegraph/sourcegraph-atom/-/commit/5b098d7fed963d88e23057ed99d73d3c7a33ad89): [all: release v1.0.5](/github.com/sourcegraph/sourcegraph-atom/-/commit/5b098d7fed963d88e23057ed99d73d3c7a33ad89)^","url":"","detail":"","content":"```COMMIT_EDITMSG\nfoo bar\n```","ranges":[[1,3,3]]}
55
{"type":"commit","icon":"","label":"[sourcegraph/sourcegraph-atom](/github.com/sourcegraph/sourcegraph-atom) › [Stephen Gutekanst](/github.com/sourcegraph/sourcegraph-atom/-/commit/5b098d7fed963d88e23057ed99d73d3c7a33ad89): [all: release v1.0.5](/github.com/sourcegraph/sourcegraph-atom/-/commit/5b098d7fed963d88e23057ed99d73d3c7a33ad89)^","url":"","detail":"","content":"```diff\nsrc/data.ts src/data.ts\n@@ -0,0 +11,4 @@\n+ return of\u003cData\u003e({\n+ title: 'Acme Corp open-source code search',\n+ summary: 'Instant code search across all Acme Corp open-source code.',\n+ githubOrgs: ['sourcegraph'],\n```","ranges":[[4,44,6]]}

internal/streaming/events.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ type EventContentMatch struct {
1717
// Type is always ContentMatchType. Included here for marshalling.
1818
Type MatchType `json:"type"`
1919

20-
Path string `json:"name"`
20+
Path string `json:"path"`
2121
Repository string `json:"repository"`
2222
Branches []string `json:"branches,omitempty"`
23-
Version string `json:"version,omitempty"`
23+
Commit string `json:"commit,omitempty"`
2424

2525
LineMatches []EventLineMatch `json:"lineMatches"`
2626
}
@@ -32,10 +32,10 @@ type EventPathMatch struct {
3232
// Type is always PathMatchType. Included here for marshalling.
3333
Type MatchType `json:"type"`
3434

35-
Path string `json:"name"`
35+
Path string `json:"path"`
3636
Repository string `json:"repository"`
3737
Branches []string `json:"branches,omitempty"`
38-
Version string `json:"version,omitempty"`
38+
Commit string `json:"commit,omitempty"`
3939
}
4040

4141
func (e *EventPathMatch) eventMatch() {}
@@ -63,10 +63,10 @@ type EventSymbolMatch struct {
6363
// Type is always SymbolMatchType. Included here for marshalling.
6464
Type MatchType `json:"type"`
6565

66-
Path string `json:"name"`
66+
Path string `json:"path"`
6767
Repository string `json:"repository"`
6868
Branches []string `json:"branches,omitempty"`
69-
Version string `json:"version,omitempty"`
69+
Commit string `json:"commit,omitempty"`
7070

7171
Symbols []Symbol `json:"symbols"`
7272
}

0 commit comments

Comments
 (0)