feat(core): broadcast_only flag for searchGlobal
This commit is contained in:
parent
00da6736e6
commit
e8a09ec270
2 changed files with 9 additions and 1 deletions
|
@ -33,7 +33,7 @@ export async function* iterSearchGlobal(
|
|||
): AsyncIterableIterator<Message> {
|
||||
if (!params) params = {}
|
||||
|
||||
const { query = '', filter = SearchFilters.Empty, limit = Infinity, chunkSize = 100 } = params
|
||||
const { query = '', filter = SearchFilters.Empty, limit = Infinity, chunkSize = 100, onlyChannels } = params
|
||||
|
||||
const minDate = normalizeDate(params.minDate) ?? 0
|
||||
const maxDate = normalizeDate(params.maxDate) ?? 0
|
||||
|
@ -49,6 +49,7 @@ export async function* iterSearchGlobal(
|
|||
minDate,
|
||||
maxDate,
|
||||
offset,
|
||||
onlyChannels,
|
||||
})
|
||||
|
||||
if (!res.length) return
|
||||
|
|
|
@ -63,6 +63,11 @@ export async function searchGlobal(
|
|||
* Only return messages older than this date
|
||||
*/
|
||||
maxDate?: Date | number
|
||||
|
||||
/**
|
||||
* Whether to only search across broadcast channels
|
||||
*/
|
||||
onlyChannels?: boolean
|
||||
},
|
||||
): Promise<ArrayPaginated<Message, SearchGlobalOffset>> {
|
||||
if (!params) params = {}
|
||||
|
@ -72,6 +77,7 @@ export async function searchGlobal(
|
|||
filter = SearchFilters.Empty,
|
||||
limit = 100,
|
||||
offset: { rate: offsetRate, peer: offsetPeer, id: offsetId } = defaultOffset,
|
||||
onlyChannels,
|
||||
} = params
|
||||
|
||||
const minDate = normalizeDate(params.minDate) ?? 0
|
||||
|
@ -87,6 +93,7 @@ export async function searchGlobal(
|
|||
offsetRate,
|
||||
offsetPeer,
|
||||
limit,
|
||||
broadcastsOnly: onlyChannels,
|
||||
})
|
||||
|
||||
assertTypeIsNot('searchGlobal', res, 'messages.messagesNotModified')
|
||||
|
|
Loading…
Reference in a new issue