Bucket global search results by type instead of one merged, unranked list - #1344
Merged
Conversation
…list Global search matched name/value/tags with the same case-insensitive substring LIKE across every object type in one shared page, so a hash observable containing the search term as a substring (e.g. "fed" inside a sha256) could crowd out real entity/indicator/dfiq name matches. Rewrites /search/ to run one AQL query that buckets results per type (entity, indicator, dfiq, observable), each with its own independent count/total, so high-volume matches in one type can never push another type's matches out of the response.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
name/value/tags with the same case-insensitive substringLIKEacross every object type in one shared, unranked page. A hash observable containing the search term as a substring (e.g.fedinside a sha256) could drown out real entity/indicator/dfiq name matches.ArangoYetiConnector.grouped_search(): one AQL query against the existingall_objects_viewthat buckets results per type (entity,indicator,dfiq,observable), each with its own independentcount/total. High-volume matches in one type can no longer push another type's matches out of the response.POST /search/to use this instead of the generic base-classfilter()path (confirmed nothing else in the codebase used that path).Test plan
tests/apiv2/search.pyrewritten for the new contract: per-type bucketing, tag/dfiq_tags substring matching,count_per_typelimiting, RBAC/ACL filtering, and a dedicated regression test reproducing the reported bug (12 matching hashes can't crowd out an entity match).unittestsuite (schemas,apiv2,core_tests) run locally — no regressions (10 pre-existing failures are unrelated/opt/yeti/...permission issues in this sandbox, not caused by this change).ruff check/format --checkandty checkclean on touched files.Companion frontend PR (sectioned
GlobalSearch.vueUI) to follow.