Files
wekan/config/search-const.js
T
Lauri Ojansivu 530ef32c16 Search cards by their card number.
#5006, open since 2023: "A customer has just hinted us that we are not able
to search cards by its number (#)". A card carries a number, the board shows
it, people quote it to each other - and the one thing that could not be done
with it was find the card again.

`number:12` now does, in the global search and everywhere else that parses
the same query. It is an EQUALITY match on a number rather than a regular
expression on text, which is the difference between finding card 12 and
finding 12, 120 and 312. A predicate that does not parse is dropped before
it reaches the selector, and an empty list adds no clause at all rather than
an impossible one.

`number:abc` is refused with the same "expected a number" error `limit:`
already gives. A string never equals a numeric field, so the alternative is
a search that silently finds nothing, which teaches nobody anything.

The issue's title says "number/#", and `#12` is deliberately not this. `#`
is already the abbreviation for a LABEL search, and reinterpreting it when
the text after it happens to be digits would break searching for a label
called "2024" - a real label name - and would make what a query means depend
on the data rather than on what was typed. The operator is the part that can
be added without taking something else away; tests/searchCardNumber.test.cjs
pins that # still means a label.

Thanks to mfilser and xet7 !

Fixes #5006,
2026-08-14 01:06:35 +03:00

57 lines
2.4 KiB
JavaScript

export const DEFAULT_LIMIT = 25;
export const OPERATOR_ASSIGNEE = 'assignees';
export const OPERATOR_COMMENT = 'comment';
export const OPERATOR_CREATED_AT = 'createdAt';
export const OPERATOR_CREATOR = 'userId';
export const OPERATOR_DEBUG = 'debug';
export const OPERATOR_DUE = 'dueAt';
export const OPERATOR_BOARD = 'board';
export const OPERATOR_HAS = 'has';
export const OPERATOR_LABEL = 'label';
export const OPERATOR_LIMIT = 'limit';
export const OPERATOR_LIST = 'list';
export const OPERATOR_MEMBER = 'members';
export const OPERATOR_MODIFIED_AT = 'modifiedAt';
export const OPERATOR_ORG = 'org';
export const OPERATOR_SORT = 'sort';
export const OPERATOR_STATUS = 'status';
export const OPERATOR_SWIMLANE = 'swimlane';
export const OPERATOR_TEAM = 'team';
export const OPERATOR_UNKNOWN = 'unknown';
export const OPERATOR_USER = 'user';
export const OPERATOR_TITLE = 'title';
// #5006 "feature request: Search for card number/#": the number a board shows on
// a card and refers to it by. `cardNumber` is the field, so the operator is
// named for what it searches, like every other one here.
export const OPERATOR_NUMBER = 'cardNumber';
export const OPERATOR_DESCRIPTION = 'description';
export const OPERATOR_CUSTOMFIELD = 'customfield';
export const OPERATOR_ATTACHMENT_TEXT = 'attachment-text';
export const OPERATOR_CHECKLIST_TEXT = 'checklist-text';
export const ORDER_ASCENDING = 'asc';
export const ORDER_DESCENDING = 'des';
export const PREDICATE_ALL = 'all';
export const PREDICATE_ARCHIVED = 'archived';
export const PREDICATE_ASSIGNEES = 'assignees';
export const PREDICATE_ATTACHMENT = 'attachment';
export const PREDICATE_CHECKLIST = 'checklist';
export const PREDICATE_CREATED_AT = 'createdAt';
export const PREDICATE_DESCRIPTION = 'description';
export const PREDICATE_DUE_AT = 'dueAt';
export const PREDICATE_END_AT = 'endAt';
export const PREDICATE_ENDED = 'ended';
export const PREDICATE_MEMBERS = 'members';
export const PREDICATE_MODIFIED_AT = 'modifiedAt';
export const PREDICATE_MONTH = 'month';
export const PREDICATE_OPEN = 'open';
export const PREDICATE_OVERDUE = 'overdue';
export const PREDICATE_PROJECTION = 'projection';
export const PREDICATE_PRIVATE = 'private';
export const PREDICATE_PUBLIC = 'public';
export const PREDICATE_QUARTER = 'quarter';
export const PREDICATE_SELECTOR = 'selector';
export const PREDICATE_START_AT = 'startAt';
export const PREDICATE_SYSTEM = 'system';
export const PREDICATE_WEEK = 'week';
export const PREDICATE_YEAR = 'year';