Skip to content

Handle empty search queries - #488

Merged
rbjornstad merged 2 commits into
mainfrom
search-empty-defaults
Jul 3, 2026
Merged

Handle empty search queries#488
rbjornstad merged 2 commits into
mainfrom
search-empty-defaults

Conversation

@rbjornstad

Copy link
Copy Markdown
Contributor

Summary

  • return user-scoped default results for empty search queries instead of relying on an empty Bleve conjunction
  • rank empty-search defaults by kind so teams come first, then applications, jobs, and other resources
  • add focused search tests for empty-query defaults, filtering, no-team users, and ranking

Testing

  • rtk go test ./internal/search
  • rtk mise run test:unit
  • rtk mise run fmt

@rbjornstad
rbjornstad requested a review from a team as a code owner July 3, 2026 08:45
@rbjornstad
rbjornstad requested a review from Copilot July 3, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Bleve-backed search implementation to treat an empty search query as “default results”, returning only user-team–scoped documents and ranking those defaults by resource kind (teams first). It also adds a focused test suite for the empty-query behavior.

Changes:

  • Add explicit handling for empty queries: return no defaults for users without teams; otherwise constrain results to the user’s team slugs.
  • Extend boosting for empty queries to include kind-based ranking (TEAM > APPLICATION > JOB > others).
  • Add unit tests covering empty-query defaults, ranking, team filtering within user teams, and no-team users.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/search/bleve.go Implements empty-query default behavior (user-team scoping) and adds kind-based boosting for deterministic default ranking.
internal/search/bleve_test.go Adds unit tests validating empty-query defaults, filtering behavior, no-team behavior, and ranking order.

@rbjornstad
rbjornstad merged commit 892e4ae into main Jul 3, 2026
12 checks passed
@rbjornstad
rbjornstad deleted the search-empty-defaults branch July 3, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants