mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-09-12 16:15:31 +08:00
allow skipping unsearchable results
This commit is contained in:
parent
ab2a099693
commit
6fffb7870d
2 changed files with 18 additions and 1 deletions
|
@ -342,6 +342,13 @@ indexes:
|
|||
user: 1
|
||||
flagged: 1
|
||||
|
||||
- collection: messages
|
||||
index:
|
||||
name: user_searchable_flag
|
||||
key:
|
||||
user: 1
|
||||
searchable: 1
|
||||
|
||||
- collection: messages
|
||||
index:
|
||||
name: mailbox_draft_flag
|
||||
|
|
|
@ -296,6 +296,7 @@ module.exports = (db, server, messageHandler) => {
|
|||
* @apiParam {String} [subject] Partial match for the Subject: header line
|
||||
* @apiParam {Boolean} [attachments] If true, then matches only messages with attachments
|
||||
* @apiParam {Boolean} [flagged] If true, then matches only messages with \Flagged flags
|
||||
* @apiParam {Boolean} [searchable] If true, then matches messages not in Junk or Trash
|
||||
* @apiParam {Number} [limit=20] How many records to return
|
||||
* @apiParam {Number} [page=1] Current page number. Informational only, page numbers start from 1
|
||||
* @apiParam {Number} [next] Cursor value for next page, retrieved from <code>nextCursor</code> response value
|
||||
|
@ -414,6 +415,10 @@ module.exports = (db, server, messageHandler) => {
|
|||
.empty('')
|
||||
.truthy(['Y', 'true', 'yes', 'on', 1])
|
||||
.falsy(['N', 'false', 'no', 'off', 0, '']),
|
||||
searchable: Joi.boolean()
|
||||
.empty('')
|
||||
.truthy(['Y', 'true', 'yes', 'on', 1])
|
||||
.falsy(['N', 'false', 'no', 'off', 0, '']),
|
||||
limit: Joi.number()
|
||||
.default(20)
|
||||
.min(1)
|
||||
|
@ -455,6 +460,7 @@ module.exports = (db, server, messageHandler) => {
|
|||
let filterSubject = result.value.subject;
|
||||
let filterAttachments = result.value.attachments;
|
||||
let filterFlagged = result.value.flagged;
|
||||
let filterSearchable = result.value.searchable;
|
||||
|
||||
let limit = result.value.limit;
|
||||
let page = result.value.page;
|
||||
|
@ -506,7 +512,11 @@ module.exports = (db, server, messageHandler) => {
|
|||
|
||||
if (filterFlagged) {
|
||||
// mailbox is not needed as there's a special index for flagged messages
|
||||
filter.flaged = true;
|
||||
filter.flagged = true;
|
||||
}
|
||||
|
||||
if (filterSearchable) {
|
||||
filter.searchable = true;
|
||||
}
|
||||
|
||||
if (datestart) {
|
||||
|
|
Loading…
Add table
Reference in a new issue