# Feature COMMS-720 - Rank exact identifier matches above fuzzy ones in work package searching and autocompleters

Project: Stream Communicator
Status: closed
URL: https://community.openproject.org/work_packages/COMMS-720

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Target versions | 17.8.0 |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

| ID | Subject | Type | Status | Assignee | Target versions | Spent time |
| --- | --- | --- | --- | --- | --- | --- |
| COMMS-925 | Implement and use exact matching order for work package identifiers | Implementation | closed | Judith Roth | 17.8.0 |  |
| COMMS-926 | Implement and use exact matching order for work package sequence numbers | Implementation | closed |  | 17.8.0 |  |
| COMMS-927 | Use new exactMatch order in op-blocknote-extensions | Implementation | closed |  | 17.8.0 |  |
| COMMS-928 | Use new exactMatch order in CKEditor | Implementation | rejected | Judith Roth |  |  |
| COMMS-938 | Allow to search for "#<semantic WP ID>" | Implementation | closed | Attila Dombi | 17.8.0 |  |

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Search |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Judith Roth |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

As a user searching by an project-based semantic work package identifier  
I want to get exact matches earlier in the search result list

<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/920585/content">

**Acceptance Criteria**

  - exact matches on the work package identifier are at the top of the list of search results, "fuzzy" matches below

  - exact matches on the sequence part (example: from `ACSMT-5` the `5`) a ranked higher than fuzzy ones. Search term "5" will show `ACSMT-5` and `XYZ-5` before `ACSMT-51` (could be a separate implementation step to keep complexity manageable)

  - Searching for a number in semantic mode does not yield search results by the database ID **expect** the number is prefixed with "\#"

  - Searching for a number in numeric mode does not yield search results by the sequence number

  - Searching for the semantic identifier is also possible when prefixed with a "\#" (e.g. \#PROJ-11)

  - Searching for the semantic identifier in numeric mode does not yield search results **except** the identifier is prefixed with "\#"

**Technical notes**

  - Since the ordering of results is independent of which attribute lead to the record being included in the result this may be very hard to do

  - Currently the sorting is done by `updated_at`, which works very well for searching in the work package subject or project title. Often the sort order is part of the API query that front-end components send to the back-end. Maybe we need another order-by that is not `updated_at` but something more clever.

  - Maybe include some "weight" in the query as first sort criteria (and further sort by `updated_at` if the weight is 0)

**Background**

  - <https://github.com/opf/openproject/pull/22732#discussion\_r3116004114>
