From a66c44ba14fbd695538ed57582aa1b6a76c9c1e9 Mon Sep 17 00:00:00 2001 From: Dmitry Gruzd <dgruzd@gitlab.com> Date: Wed, 30 Aug 2023 13:16:10 +0000 Subject: [PATCH] Update Zoekt syntax documentation --- doc/user/search/exact_code_search.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/user/search/exact_code_search.md b/doc/user/search/exact_code_search.md index 8a64dc9e70f31..48445ccfc3cd0 100644 --- a/doc/user/search/exact_code_search.md +++ b/doc/user/search/exact_code_search.md @@ -28,5 +28,19 @@ searches. ## Syntax -To understand the possible filtering options, see the -[Zoekt query syntax](https://github.com/sourcegraph/zoekt/blob/main/doc/query_syntax.md). +This table shows some example queries for exact code search. + +| Query | Description | +| -------------------- |-------------------------------------------------------------------------------------- | +| `foo` | Returns files that contain `foo` | +| `"class foo"` | Returns files that contain the exact string `class foo` | +| `class foo` | Returns files that contain both `class` and `foo` | +| `foo or bar` | Returns files that contain either `foo` or `bar` | +| `class Foo` | Returns files that contain `class` (case insensitive) and `Foo` (case sensitive) | +| `class Foo case:yes` | Returns files that contain `class` and `Foo` (both case sensitive) | +| `foo -bar` | Returns files that contain `foo` but not `bar` | +| `foo file:js` | Searches for `foo` in files with names that contain `js` | +| `foo -file:test` | Searches for `foo` in files with names that do not contain `test` | +| `foo lang:ruby` | Searches for `foo` in Ruby source code | +| `foo f:\.js$` | Searches for `foo` in files with names that end with `.js` | +| `foo.*bar` | Searches for strings that match the regular expression `foo.*bar` | -- GitLab