Skip to content

Search & filtering improvements#32

Merged
kedare merged 3 commits intomainfrom
better-search
Feb 10, 2026
Merged

Search & filtering improvements#32
kedare merged 3 commits intomainfrom
better-search

Conversation

@kedare
Copy link
Owner

@kedare kedare commented Feb 10, 2026

Summary

Major enhancement to the global search and TUI filtering capabilities:

  • New searchable resource: VPC Routes (compute.route) — searches by name, description, destination range, network, and next hop with smart next-hop resolution (gateway, instance, IP, VPN tunnel, ILB, peering)
  • Enriched IP address search — now matches on description, subnetwork, and users fields
  • Enriched firewall rules search — now matches on description, source ranges, target tags, and allowed protocols
  • Fuzzy matching toggle — press Tab in global search to switch between exact and fuzzy mode (e.g. "prd" matches "production")
  • Advanced filter syntax across all TUI views — spaces for AND, | for OR, - prefix for NOT (e.g. web|api prod -staging)
  • Search matches on detail fields — all 22 resource providers now use MatchesAny() to search across name + detail fields (description, IPs, tags, etc.)
  • Matched text highlighting — search terms are highlighted in results for easier scanning
  • README updated — documents new TUI section, filtering syntax, routes, and updated resource table

Filter syntax examples

Input Meaning
web prod Contains "web" AND "prod"
web|api Contains "web" OR "api"
-dev Does NOT contain "dev"
db|sql prod -staging ("db" or "sql") AND "prod", NOT "staging"

Changes

New files

  • internal/tui/filter.go — filter expression parser (AND/OR/NOT)
  • internal/tui/filter_test.go — 41 tests for the filter parser
  • internal/gcp/search/routes.go — VPC routes search provider
  • internal/gcp/search/routes_test.go — route provider tests

Modified files

  • internal/gcp/types.go — added Route struct, enriched Address and FirewallRule structs
  • internal/gcp/resources.go — added ListRoutes(), enriched ListAddresses() and ListFirewallRules()
  • internal/gcp/search/types.go — added KindRoute, Fuzzy field on Query, fuzzy matching in Matches()/MatchesAny()
  • internal/tui/search_view.go — fuzzy toggle (Tab), filter syntax, highlight, route provider registration
  • internal/tui/direct.go — uses parseFilter/matches for advanced filtering
  • internal/tui/instance_view.go — uses parseFilter/matches for advanced filtering
  • internal/tui/connectivity_view.go — uses parseFilter/matches for advanced filtering
  • internal/tui/vpn_view.go — uses parseFilter/matches for advanced filtering
  • internal/tui/project_selector.go — uses parseFilter/matches for advanced filtering
  • internal/tui/ip_lookup_view.go — uses parseFilter/matches for advanced filtering
  • internal/gcp/search/addresses.go — matches on description, details include subnetwork/users
  • internal/gcp/search/firewall_rules.go — matches on description/source ranges/target tags/allowed
  • All 20 provider test files — added detail-field matching tests
  • README.md — updated with TUI section, filtering docs, routes, enriched resource table

Test plan

  • go build ./... compiles cleanly
  • go test ./internal/gcp/search/... -v — all provider tests pass (116+ tests)
  • go test ./internal/tui/... -v — all TUI tests pass (41 tests including filter parser)
  • Manual: launch compass interactive, press /, type db test — should match db-test-1
  • Manual: launch compass interactive, press /, type db|test — should match db-test-1
  • Manual: press Shift+S, search for a term, press Tab to toggle fuzzy, verify label changes
  • Manual: in global search, press /, type compute.instance prod -dev, verify AND/OR/NOT filtering

🤖 Generated with Claude Code

@kedare kedare self-assigned this Feb 10, 2026
@kedare kedare merged commit 4dfa68f into main Feb 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant