[COMMS-938] Allow to search for "#<semantic WP ID>" - #24662
Conversation
There was a problem hiding this comment.
Pull request overview
Enables hash-prefixed semantic work package searches such as #PROJ-11.
Changes:
- Strips the hash when filtering and ranking semantic identifiers.
- Adds coverage for hash-prefixed searches and exact-match ranking.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
app/models/queries/work_packages/filter/typeahead_filter.rb |
Parses optional hash prefixes before identifier filtering. |
app/models/queries/work_packages/selects/exact_match_select.rb |
Uses the normalized identifier for ranking. |
spec/models/queries/work_packages/filter/typeahead_filter_spec.rb |
Tests hash-prefixed filtering. |
spec/models/queries/work_packages/selects/exact_match_select_spec.rb |
Tests hash-prefixed exact-match ranking. |
c9fd54e to
1a7404b
Compare
a6669fb to
c0b2ecc
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
| if (match = part.match(/\A(#)?(#{Projects::Identifier::SEMANTIC_FORMAT.source}-?\d*)\z/i)) | ||
| conditions << work_package_identifier_condition(match[2]) |
There was a problem hiding this comment.
I wonder why we need to capture the #? It does not seem to be used anywhere.
| if (match = part.match(/\A(#)?(#{Projects::Identifier::SEMANTIC_FORMAT.source}-?\d*)\z/i)) | |
| conditions << work_package_identifier_condition(match[2]) | |
| if (match = part.match(/\A#?(#{Projects::Identifier::SEMANTIC_FORMAT.source}-?\d*)\z/i)) | |
| conditions << work_package_identifier_condition(match[1]) |
There was a problem hiding this comment.
👀 Eagle eyes! Thanks a lot for this comment. Together with your feedback here and after sleeping a night over it, I now implemented it the following way:
- If the instance is in semantic mode, searching by a semantic identifier with or without "#" works
- If the instance is in classic (numeric) mode, searching by a semantic identifier only works when prefixed with "#"
This is the same (but reverse) like in semantic mode, where searching for a number only searches by the ID if prefixed with "#". It should mainly help to keep the search fast by not including search results that are probably not wanted and also keep the search results understandable.
Thanks for pointing it out!
Deploying openproject with ⚡ PullPreview
|
c97a537 to
d740bc2
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
a14a857 to
dd87aab
Compare
…sh-prefixed https://community.openproject.org/wp/COMMS-938 This has two advantages: 1. It's easier to understand since it works the same way in classic identifier mode: Only when the number is prefixed with a hash the ID is searched 2. Otherwise in classic identifier mode the WorkPackageSemanticAlias table would be hit for every string that starts with a letter, which is unnecessary and makes the search even slower
dd87aab to
226d9bc
Compare
Ticket
https://community.openproject.org/wp/COMMS-938
What are you trying to accomplish?
Searching for "#PROJ-11" should lead to the same result as searching for "PROJ-11".
Merge checklist