feat: Added new docs

This commit is contained in:
Deven Joshi
2021-06-17 15:06:01 +05:30
parent ec8e385927
commit 98d8f75907
4 changed files with 212 additions and 0 deletions
@@ -4,3 +4,28 @@ sidebar_position: 20
title: Searching Messages
---
Message search is built-in to the chat API. You can enable and/or disable the search indexing on a per channel type.
The command shown below selects the channels in which John is a member.
Next, it searches the messages in those channels for the keyword “'supercalifragilisticexpialidocious'”:
```dart
final search = await client.search(
Filter.in_('members', ['john']),
query: 'supercalifragilisticexpialidocious',
paginationParams: PaginationParams(
limit: 2,
offset: 0
),
);
```
Pagination works via the standard limit and offset parameters. The first argument, filter, uses a MongoDB style query expression.
We do not run MongoDB on the backend, so only a subset of the standard MongoDB filters are supported.
Additionally, this endpoint can be used to search for messages that have attachments.
```dart
// Search file of type videos
final response = await channel.search(messageFilter: Filter.in_('attachments.type', ['video']));
return response;
```