Skip to content

Symbol Search

Symbol search combines Reflex’s full-text trigram search with runtime Tree-sitter parsing to filter results down to symbol definitions — functions, classes, structs, interfaces, and more.

Reflex uses a two-phase approach:

  1. Trigram search finds all files containing the query text (fast, milliseconds)
  2. Tree-sitter parsing runs on each candidate file to identify symbol definitions (lazy, on-demand)

This “runtime symbol detection” architecture means indexing is instant (no parsing during rfx index) while symbol searches are still fast because trigrams narrow the search space first.

Add --symbols (or -s) to any query:

Terminal window
rfx query "authenticate" --symbols
src/auth/mod.rs:42 [Function] pub fn authenticate(creds: &Credentials) -> Result<Session>
1 result in 4ms

Without --symbols, this query would also find calls, comments, and string literals containing “authenticate”. With it, only definitions appear.

Use --kind to restrict to a specific symbol type:

Terminal window
# Only functions
rfx query "handle" --symbols --kind function
# Only structs
rfx query "Config" --symbols --kind struct
# Only interfaces (TypeScript, Go)
rfx query "Repository" --symbols --kind interface
KindDescription
functionFunctions, methods
classClasses
structStructs (Rust, Go, C)
enumEnums
traitTraits (Rust)
interfaceInterfaces (TypeScript, Go, Java)
typeType aliases
constantConstants
variableVariables, let bindings
methodMethods (when distinguishable from functions)

Symbol kinds vary by language — see Supported Languages for what each language extracts.

Symbol search composes with all other query filters:

Terminal window
# Symbols in a specific language
rfx query "parse" --symbols --lang rust
# Symbols matching a path pattern
rfx query "Handler" --symbols --paths "src/api/"
# JSON output for tooling
rfx query "Config" --symbols --kind struct --json

Symbol search adds Tree-sitter parsing to the query pipeline, but this only runs on files that pass the trigram filter. Typical overhead is 1–5ms on top of the base query time.

On large codebases, symbol search is often faster in practice because it returns fewer results, reducing output formatting time.