-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
e1947d1
to
59b6a1d
Compare
LargeFiles []string | ||
} | ||
|
||
// serveSearchConfiguration is _only_ used by the zoekt index server. Zoekt does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go doc comments aren't supposed to include markdownish things like foo or bar
.
See golang/go#16666 for some discussion about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm optimizing for reading in sourcegraph. Sourcegraph tooltips render as markdown. See this comment in sourcegraph here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's probably a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's a sourcegraph feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah lots of people use markdown in godoc even though it isn't supported. Luckily godoc has so little features it doesn't ever conflict.
136aa24
to
cc184b8
Compare
LGTM once the tests pass. |
ffb2138
to
a8e613d
Compare
a8e613d
to
87da254
Compare
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have inline suggestions, but otherwise LGTM.
My only possible concern with this implementation is its a global setting across all repositories. However, that is actually good! We can always add a way to narrow it down to a specific repo in the future.
LargeFiles []string | ||
} | ||
|
||
// serveSearchConfiguration is _only_ used by the zoekt index server. Zoekt does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah lots of people use markdown in godoc even though it isn't supported. Luckily godoc has so little features it doesn't ever conflict.
cmd/searcher/search/store.go
Outdated
// key is a sha256 hash since we want to use it for the disk name | ||
h := sha256.Sum256([]byte(string(repo.Name) + " " + string(commit))) | ||
h := sha256.Sum256([]byte(string(repo.Name) + " " + string(commit) + " " + string(lfpBytes))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid the marshalling and have a simpler implementation:
h := sha256.Sum256([]byte(string(repo.Name) + " " + string(commit) + " " + string(lfpBytes))) | |
h := sha256.Sum256([]byte(fmt.Sprintf("%q %q %q", repo.Name, commit, conf.Get().SearchLargeFiles))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooooh fancy. Didn't know about %q
cmd/searcher/search/store.go
Outdated
if hdr.Size > maxFileSize { | ||
// We do not search the content of large files unless they are | ||
// whitelisted. | ||
if hdr.Size > maxFileSize && !ignoreSizeMax(hdr.Name, conf.Get().SearchLargeFiles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want to use a consistent SearchLargeFiles here, while this can change. Additionally there is an overhead of getting the config, and this is done for each file here.
Good enough suggestion: outside of the loop do largeFiles := conf.Get()
and use largeFiles
here.
More consistent suggestion: Pass down the largeFiles
used in prepareZip
.
schema/site.schema.json
Outdated
"items": { | ||
"type": "string" | ||
}, | ||
"group": "Search" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add examples. JSON schema supports the "examples"
key.
schema/site.schema.json
Outdated
@@ -22,6 +22,14 @@ | |||
"!go": { "pointer": true }, | |||
"group": "Search" | |||
}, | |||
"search.largeFiles": { | |||
"description": "A list of file glob patterns where matching files will be indexed and searched regardless of their size.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the description of the glob format (godoc link is good enough)
This PR is part of the solution for #1624. We are adding a configuration option called "search.largeFiles" which is a list of glob patterns. Any files matching the patterns in the list will be indexed and searched regardless of the size.
This PR:
Test plan:
Testing searcher implementation:
"search.index.enabled": false,
"search.largeFiles": ["bigfile.txt"]
to config