feat: add search emoji by substring (#5585)

Before the fix emoji could be found only by a subsctring from a string start. 

For example, we have two emojis
1) foo
2) bar_foo

When you perform a search by keyword 'foo' only the first one will be found.

Now, both will be found.

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
This commit is contained in:
Alex Plekhov 2024-02-26 14:25:27 +03:00 committed by GitHub
parent 55f3de5449
commit f56f19abc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ export const searchEmojis = async (keyword: string): Promise<IEmoji[]> => {
const likeString = sanitizeLikeString(keyword);
const whereClause = [];
if (likeString) {
whereClause.push(Q.where('name', Q.like(`${likeString}%`)));
whereClause.push(Q.where('name', Q.like(`%${likeString}%`)));
}
const db = database.active;
const customEmojisCollection = await db