-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Attempting full explanation of select feature #23250
Conversation
Per https://sourcegraph.slack.com/archives/CU93UDUBV/p1627335004461700?thread_ts=1627315672.453300&cid=CU93UDUBV — open to pushback if this seems gnarly.
Notifying subscribers in CODENOTIFY files for diff a2f368c...3b101e4.
|
Any chance you can post a screenshot of how this renders? Would make it easy to review :-) |
doc/code_search/reference/queries.md
Outdated
@@ -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) | |
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.
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.
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, 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?
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.
New commit with it italicized—seem better?
@rvantonder I know you already approved, but does the render screenshot above change anything? |
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 |
Will do, thanks! |
Per https://sourcegraph.slack.com/archives/CU93UDUBV/p1627335004461700?thread_ts=1627315672.453300&cid=CU93UDUBV — open to pushback if this seems gnarly.