Skip to content

fix(search): skip entity types with ids_only and empty IDs in unified search#2529

Merged
whutchinson98 merged 1 commit into
mainfrom
fix-unified-search-filters
Apr 13, 2026
Merged

fix(search): skip entity types with ids_only and empty IDs in unified search#2529
whutchinson98 merged 1 commit into
mainfrom
fix-unified-search-filters

Conversation

@gbirman
Copy link
Copy Markdown
Contributor

@gbirman gbirman commented Apr 13, 2026

Summary

  • Fixes "unable to search" error in unified search when entity types using ids_only mode resolve to zero matching IDs
  • Channels (always ids_only: true): excluded from OpenSearch query when user has no channels
  • Documents/Chats (ids_only when filtered by project, owner, file type): excluded when filters match nothing
  • Emails and Projects are unaffected (emails never use ids_only, projects are not in OpenSearch)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

Warning

Rate limit exceeded

@gbirman has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 48 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 48 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: de378a39-e26a-4331-9901-cf6f3882b3d3

📥 Commits

Reviewing files that changed from the base of the PR and between 4085b41 and 68a6011.

📒 Files selected for processing (1)
  • rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs

Walkthrough

Updated the construction logic of unified OpenSearch search_indices for Documents and Chats. Documents are now inserted when should_include_documents is true and either ids_only is false or document_ids is non-empty. Chats follow the same conditional pattern. Channels, Emails, and Projects remain unchanged.

Changes

Cohort / File(s) Summary
Search Indices Construction Logic
rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs
Modified conditional logic for inserting Documents and Chats into unified search indices to require both feature enablement flags and non-empty identifier conditions. Channels, Emails, and Projects insertion logic unchanged.
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title exceeds the 72-character limit at 76 characters and uses the correct conventional commits format. Shorten the title to comply with the 72-character requirement, e.g., 'fix(search): skip entity types with empty ids_only results'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is directly related to the changeset and clearly explains the fix, affected entity types, and scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-unified-search-filters

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

… search

When building the OpenSearch unified search query, entity types that use
ids_only mode (channels always, documents/chats when filtered by project,
owner, etc.) would fail with EmptyIdsWithIdsOnly if the filter resolved
to zero matching IDs. This caused a generic "unable to search" error.

Now we exclude these entity types from search_indices when their ID list
is empty, matching the behavior of the individual name search paths which
already handle empty results gracefully.
@gbirman gbirman force-pushed the fix-unified-search-filters branch from 4085b41 to 68a6011 Compare April 13, 2026 18:45
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs`:
- Around line 278-295: Extend the simple_unified tests to cover the regression:
create cases where filter_document_response.ids_only == true with document_ids
empty and filter_chat_response.ids_only == true with chat_ids empty and
filter_channel_response.channel_ids empty, then assert that the produced
search_indices (or the set built in the simple_unified search flow) does NOT
contain models_opensearch::SearchEntityType::Documents, ::Chats, or ::Channels
respectively; also add complementary assertions where ids_only == false (or ids
non-empty) to verify those entity types are included. Locate the test
scaffolding that constructs filter_document_response / filter_chat_response /
filter_channel_response and the code path that produces search_indices in the
simple_unified tests, reuse those builders/mocks and add assertions for both the
ids_only=true/empty and ids_only=false cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fa6e2355-6a46-4569-bb63-3dae2df65fbc

📥 Commits

Reviewing files that changed from the base of the PR and between 731b159 and 4085b41.

📒 Files selected for processing (1)
  • rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs

Comment thread rust/cloud-storage/search_service/src/api/search/simple/simple_unified.rs Outdated
@whutchinson98 whutchinson98 merged commit 1c72e4f into main Apr 13, 2026
37 of 38 checks passed
@whutchinson98 whutchinson98 deleted the fix-unified-search-filters branch April 13, 2026 19:11
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.

2 participants