Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Attempting full explanation of select feature #23250

Merged
merged 2 commits into from
Jul 27, 2021
Merged

Conversation

emchap
Copy link
Contributor

@emchap emchap commented Jul 26, 2021

@emchap emchap requested review from rrhyne and rvantonder July 26, 2021 21:36
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jul 26, 2021

Notifying subscribers in CODENOTIFY files for diff a2f368c...3b101e4.

Notify File(s)
@christinaforney doc/code_search/reference/queries.md
@rvantonder doc/code_search/reference/queries.md

@rvantonder
Copy link
Contributor

Any chance you can post a screenshot of how this renders? Would make it easy to review :-)

@@ -80,7 +80,7 @@ The following keywords can be used on all searches (using [RE2 syntax](https://g
| **-file:regexp-pattern** <br> _alias: -f_ | Exclude results from files whose full path matches the regexp. | [`file:\.js$ -file:test http`](https://sourcegraph.com/search?q=file:%5C.js%24+-file:test+http) |
| **content:"pattern"** | Set the search pattern with a dedicated parameter. Useful when searching literally for a string that may conflict with the [search pattern syntax](#search-pattern-syntax). In between the quotes, the `\` character will need to be escaped (`\\` to evaluate for `\`). | [`repo:sourcegraph content:"repo:sourcegraph"`](https://sourcegraph.com/search?q=repo:sourcegraph+content:"repo:sourcegraph"&patternType=literal) |
| **-content:"pattern"** | Exclude results from files whose content matches the pattern. Not supported for structural search. | [`file:Dockerfile alpine -content:alpine:latest`](https://sourcegraph.com/search?q=file:Dockerfile+alpine+-content:alpine:latest&patternType=literal) |
| **select:result-type** | Shows only query results for a given type. For example, `select:repo` displays only distinct reopsitory paths from search results. See [language definition](language.md#select) for possible values. | [`fmt.Errorf select:repo`](https://sourcegraph.com/search?q=fmt.Errorf+select:repo&patternType=literal) |
| **select:result-type** <br> **select:repo** <br> **select:commit.diff.added** <br> **select:commit.diff.removed** <br> **select:file** <br> **select:content** <br> **select:symbol.symboltype** | Shows only query results for a given type. For example, `select:repo` displays only distinct reopsitory paths from search results, and `select:commit.diff.added` shows only added code matching the search. See [language definition](language.md#select) for full list of possible values. | [`fmt.Errorf select:repo`](https://sourcegraph.com/search?q=fmt.Errorf+select:repo&patternType=literal) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: symbol.symboltype scans just a bit weird since symboltype isn't an actual value, but I sort of get what it's trying to say? Like maybe symbol. symboltype with italicized markdown? Dunno.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, basically I was trying to at least cover the full set of types, but of course there's many type of symbols so I can't do all of them. I was following the convention of result-type up top, which was there to start with. I can italicize both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New commit with it italicized—seem better?

@emchap
Copy link
Contributor Author

emchap commented Jul 26, 2021

Any chance you can post a screenshot of how this renders? Would make it easy to review :-)

I don't have a local docs site set up unfortch, but GH's render seems to match pretty closely with how it looks today and so I'd feel comfortable using it as an approximation:

image

@emchap
Copy link
Contributor Author

emchap commented Jul 27, 2021

@rvantonder I know you already approved, but does the render screenshot above change anything?

@rvantonder
Copy link
Contributor

I think being exhaustive is good. It does have the downside of a lot of text (it's busy). But that's the tradeoff, I don't have a recommendation besides this. Note a potential pitfall here is using a select value, like for symbol, won't return results unless the query also specifies type:symbol. This is where it gets difficult to jam a comprehensive, definitive explanation of how select works beyond just the syntax in this table. I suggest you merge and we can see how it goes

@emchap
Copy link
Contributor Author

emchap commented Jul 27, 2021

Will do, thanks!

@emchap emchap merged commit 9c1dd35 into main Jul 27, 2021
@emchap emchap deleted the emchap/signs-and-symbols branch July 27, 2021 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants