mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 09:43:29 +00:00
keyword search filter in eventdb
This commit is contained in:
parent
97037017c2
commit
0af59a04ef
@ -81,7 +81,15 @@ class EventDB {
|
||||
let chain = this.eventsCollection
|
||||
.chain()
|
||||
.find(query)
|
||||
.where((e: Event) => matchFilter(filter, e))
|
||||
.where((e: Event) => {
|
||||
if (!matchFilter(filter, e)) {
|
||||
return false;
|
||||
}
|
||||
if (filter.keywords && !filter.keywords.some((keyword) => e.content?.includes(keyword))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.simplesort('created_at', true);
|
||||
|
||||
if (filter.limit) {
|
||||
|
Loading…
Reference in New Issue
Block a user