Addressed search critique in #1258#1281
Merged
VisLab merged 4 commits intohed-standard:mainfrom Mar 25, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the HED query/search implementation and related tests to address critique items raised in #379, focusing on clearer query parse errors, more explicit match-mode handling, and improved traversal performance in HedGroup.
Changes:
- Improve
get_query_handlerserror reporting by including exception details for bad queries. - Update query parsing behavior (tokenization and match-mode constants) and add targeted regression tests.
- Optimize
HedGroup.get_all_tags/get_all_groupstraversal by switching todequeto avoid O(n²) list operations.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
hed/models/query_service.py |
Include exception details in bad-query issue strings returned by get_query_handlers. |
hed/models/query_util.py |
Update comment describing Token.NotInLine. |
hed/models/query_handler.py |
Remove [[ / ]] from tokenizer so [[a]] parses as nested descendant groups. |
hed/models/query_expressions.py |
Replace implicit/bool match-mode flags with named constants and update matching logic accordingly. |
hed/models/hed_group.py |
Use collections.deque in traversal helpers to avoid repeated pop(0) operations. |
tests/models/test_query_service.py |
Add new unit tests for get_query_handlers and search_hed_objs. |
tests/models/test_query_handler.py |
Add regression tests for double-bracket handling and match-mode constants. |
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.
Several of the items, including the O(n^2) operations will require a redesign and were not implemented.