mirror of
https://github.com/wekan/wekan.git
synced 2026-02-02 14:41:47 +01:00
Add new has operator for searching
This commit is contained in:
parent
c02b71e0e1
commit
726be664c8
4 changed files with 43 additions and 2 deletions
|
|
@ -507,6 +507,20 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) {
|
|||
});
|
||||
}
|
||||
|
||||
if (queryParams.has.length) {
|
||||
queryParams.has.forEach(has => {
|
||||
if (has === 'description') {
|
||||
selector.description = { $exists: true, $nin: [null, ''] };
|
||||
} else if (has === 'attachment') {
|
||||
const attachments = Attachments.find({}, { fields: { cardId: 1 } });
|
||||
selector.$and.push({ _id: { $in: attachments.map(a => a.cardId) } });
|
||||
} else if (has === 'checklist') {
|
||||
const checklists = Checklists.find({}, { fields: { cardId: 1 } });
|
||||
selector.$and.push({ _id: { $in: checklists.map(a => a.cardId) } });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (queryParams.text) {
|
||||
const regex = new RegExp(escapeForRegex(queryParams.text), 'i');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue