Return empty response when no targets are available
What does this MR do and why?
Return empty response when no targets are available. The edge case occurs when AST syntax queries are enabled and traversal ID queries are disabled but no nodes are available for searching.
When traversal ID queries are enabled, targets will no longer be used and search will naturally return empty results. Until traversal ID queries are enabled, we need to short circuit the search and return empty results early if there are no targets present.
AI Summary
This change adds a safety check to the search functionality. When a specific search feature (traversal ID queries) is turned off and no search targets are provided, the system will now immediately return an empty result instead of continuing with the search process. This prevents unnecessary work and potential errors when the search doesn't have anything to look for. The change also includes a debug message to help developers understand why an empty result was returned, and adds tests to verify this new behavior works correctly.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.