[COMMS-926] Allow to search by sequence number (in semantic mode) - #24497
Conversation
919422f to
040f593
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. |
fd2260d to
376c555
Compare
There was a problem hiding this comment.
Pull request overview
Adds “exact match first” ranking and semantic-mode sequence-number search behavior to work package typeahead/autocomplete across API + frontend, while requiring #<number> to search by database id in semantic identifier mode to avoid confusing results.
Changes:
- Introduces an
exactMatchsort key (backed by a newExactMatchSelect) to boost exact id/sequence-number/semantic-identifier hits when atypeaheadfilter is active. - Updates typeahead filtering to route bare numeric searches to
sequence_numberin semantic mode (and toidin classic mode or when prefixed with#). - Updates frontend autocompleters/filter pickers and adds tests, API docs notes, locale label, and a DB index on
work_packages.sequence_number.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/requests/api/v3/work_packages/index_resource_spec.rb | Adds request spec asserting exact-match ranking in work package collection responses. |
| spec/requests/api/v3/work_packages/available_relation_candidates_resource_spec.rb | Adds request spec for exact-match ranking in relation candidate results. |
| spec/models/query/sort_criteria_spec.rb | Verifies exact_match sort resolves to correct SQL fragments depending on typeahead filter presence. |
| spec/models/queries/work_packages/selects/exact_match_select_spec.rb | New unit spec coverage for exact-match SQL generation and ranking behavior. |
| spec/models/queries/work_packages/filter/typeahead_filter_spec.rb | Expands typeahead filter specs for classic vs semantic numeric search behavior and # prefix semantics. |
| spec/features/work_packages/table/queries/parent_field_ranking_spec.rb | New feature spec ensuring Parent inline field dropdown ranks exact identifier matches first. |
| spec/features/work_packages/table/queries/parent_ancestor_filter_ranking_spec.rb | New feature spec ensuring Parent/Ancestor filter dropdowns rank exact identifier matches first. |
| spec/features/work_packages/table/queries/id_filter_ranking_spec.rb | New feature spec ensuring ID filter dropdown ranks exact identifier matches first. |
| spec/features/work_packages/table/configuration_modal/sort_by_spec.rb | Ensures “Exact match” isn’t exposed as a user-selectable sort option in the modal. |
| spec/controllers/work_packages/auto_completes_controller_spec.rb | Extends controller spec to cover exact-match ranking and blank/multi-word query handling. |
| modules/boards/spec/features/board_reference_work_package_ranking_spec.rb | New boards feature spec ensuring “Add existing work package” ranks exact identifier matches first. |
| frontend/src/app/shared/components/fields/edit/field-types/work-package-edit-field.component.ts | Adds exactMatch sort for Parent allowed-values fetch; tightens return type. |
| frontend/src/app/shared/components/autocompleter/op-autocompleter/services/op-autocompleter.service.ts | Adds exactMatch sort to work package autocompleter requests. |
| frontend/src/app/features/work-packages/components/wp-relations/wp-relations-create/wp-relations-autocomplete/wp-relations-autocomplete.component.ts | Adds exactMatch sort to relation-candidates autocomplete fetch; clarifies unsafe HAL typing with comments. |
| frontend/src/app/features/work-packages/components/filters/filter-searchable-multiselect-value/filter-searchable-multiselect-value.component.ts | Forces XHR for work-package-referencing filters and adds exactMatch sort when querying work packages. |
| frontend/src/app/features/boards/board/inline-add/board-inline-add-autocompleter.component.ts | Adds exactMatch sort to board inline-add fetch and improves error handling; adds lint suppression comments for legacy selector/output names. |
| frontend/src/app/core/apiv3/endpoints/work_packages/api-v3-work-packages-paths.ts | Uses exactMatch as primary sort key in work package search path building and tightens generic casting. |
| frontend/src/app/core/apiv3/api-v3.service.spec.ts | Updates frontend APIv3 service spec expectations for exactMatch-first sorting. |
| docs/api/apiv3/paths/work_packages.yml | Documents availability of exactMatch sort key on the work packages endpoint. |
| docs/api/apiv3/paths/work_package_available_relation_candidates.yml | Documents exactMatch support for relation candidates endpoint via work packages sort criteria. |
| db/migrate/20260728120000_add_index_on_work_package_sequence_number.rb | Adds a concurrent partial index on work_packages.sequence_number for lookup performance. |
| config/locales/en.yml | Adds exact_match translation label. |
| app/models/query.rb | Passes query context into column sortable to allow query-dependent SQL generation. |
| app/models/queries/work_packages/selects/work_package_select.rb | Extends sortable to accept an optional query arg and forward it into Proc-valued sortables. |
| app/models/queries/work_packages/selects/typeahead_select.rb | Updates sortable Proc signature to accept (ignored) query argument. |
| app/models/queries/work_packages/selects/property_select.rb | Updates sortable Proc signature to accept (ignored) query argument. |
| app/models/queries/work_packages/selects/exact_match_select.rb | New select implementing query/typeahead-aware exact-match boost SQL. |
| app/models/queries/work_packages/filter/typeahead_filter.rb | Routes numeric terms to id vs sequence number based on identifier mode / # prefix. |
| app/models/queries/work_packages.rb | Registers the new ExactMatchSelect for work package queries. |
| app/controllers/work_packages/auto_completes_controller.rb | Applies exact_match then updated_at sorting to work package autocomplete results. |
376c555 to
3c834a5
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. |
3c834a5 to
2b9116c
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. |
2b9116c to
f91b8ab
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. |
f91b8ab to
3c21690
Compare
https://community.openproject.org/wp/COMMS-926 To prevent that people see search results which they don't understand, searching for the ID in semantic mode requires prefixing the number with "#". When searching for a number in classic mode, it will always match against the ID and never against the sequence number. If that turns out to not be good enough in the future, we have to improve the rendering of serach results and include the reason there (e.g. the database ID if that was matching and the instance is in semantic mode).
In semantic mode it could happen that a work package with an ID which is the same as a search term is found and it would have been boosted accidentally. Now this is gated and we only boost on ID match in classic mode or when the search was prefixed with "#".
3c21690 to
f6760f0
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. |
f6760f0 to
8793f52
Compare
|
Caution The provided work package version does not match the core version Details:
Please make sure that:
|
| operator: "**", | ||
| values: "COM-5" | ||
| } | ||
| context "when filtering by typeahead and sorting by exact_match to rank an identifier match first" do |
There was a problem hiding this comment.
This spec was just refactored for better readability
|
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. |
Ticket
https://community.openproject.org/wp/COMMS-926
To prevent that people see search results which they don't understand,
searching for the ID in semantic mode requires prefixing the number with
"#". When searching for a number in classic mode, it will always match
against the ID and never against the sequence number.
If that turns out to not be good enough in the future, we have to
improve the rendering of search results and include the reason there
(e.g. the database ID if that was matching and the instance is in
semantic mode).
What are you trying to accomplish?
Improve search results by
Screenshots
NOT IMPLEMENTED LIKE THIS, JUST FOR CLARIFICATION WHAT SHOULD NOT HAPPEN:
RESULT AFTER THIS PR:
What approach did you choose and why?
Enhance existing search filters and selects. Decide based on work packages identifiers setting what search results searching by a number should yield.
Merge checklist