@@ -48,40 +48,40 @@ When searching a repository, command chaining can be used to return more specifi
4848
4949** Search for a repository that contains a file**
5050
51- If you are searching for a file in a repository, use ` repo:contains.file ` .
51+ If you are searching for a file or a file path in a repository, use ` repo:has.path ` .
5252
5353<Highlighter
54- input='repo: repository-path repo: contains .file (file-path)'
54+ input='repo: repository-path repo: has .path (file-path)'
5555matcher='file-path'
5656/>
5757
5858For example, when searching for the ` package.json ` file in a project, this search query will return the file.
5959
60- <SourcegraphSearch query =" repo:^github\.com/sourcegraph/.* repo:contains.file (package.json) " />
60+ <SourcegraphSearch query =" repo:^github\.com/sourcegraph/.* repo:has.path (package.json) " />
6161
62- A similar example that uses the content query to search for files is shown below .
62+ Alternatively, you can use ` repo:has.file ` , which allows you to search for files containing content .
6363
64- <SourcegraphSearch query =" repo:contains( file:package\.json$ content:ts ) " />
64+ <SourcegraphSearch query =" repo:has. file(path :package\.json$ content:tsconfig ) " />
6565
66- This query returns repositories that contain a ` package.json ` file and has content written in TypeScript .
66+ This query returns repositories that contain a ` package.json ` file containing the string ` tsconfig ` .
6767
6868** Search for a repository that contains some content**
6969
70- Suppose you are searching for some content in a repository, such as a library. Use ` repo:contains .content ` .
70+ Suppose you are searching for some content in a repository, such as a library. Use ` repo:has .content ` .
7171
7272<Highlighter
73- input='repo: repo-path repo: contains .content(your-content)'
73+ input='repo: repo-path repo: has .content(your-content)'
7474matcher='your-content'
7575/>
7676
7777<Highlighter
78- input='repo: repo-path repo: contains .content(regular-pattern)'
78+ input='repo: repo-path repo: has .content(regular-pattern)'
7979matcher='regular-pattern'
8080/>
8181
8282We can search for the ` mdi-react ` library in Sourcegraph, for example:
8383
84- <SourcegraphSearch query =" repo:^github\.com/sourcegraph/.* repo:contains .content(mdi-react) " />
84+ <SourcegraphSearch query =" repo:^github\.com/sourcegraph/.* repo:has .content(mdi-react) " />
8585
8686
8787The above query returns repos that have ` mdi-react ` among its contents.
0 commit comments