Skip to content

Commit 366afa6

Browse files
committed
Do AND of filter words for string find
1 parent 3c2bf69 commit 366afa6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/convert-filter.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ export const convertFilter = (filter) => {
1616
switch (property.type()) {
1717
case 'string':
1818
return {
19-
[property.name()]: { $regex: escape(value), $options: 'i' },
19+
[property.name()]: { $regex: new RegExp(
20+
value
21+
.split(' ')
22+
.map((word) => '(?=.*\\b' + escape(word) + '\\b)')
23+
.join('') + '.+'
24+
), $options: 'i' },
2025
...memo,
2126
}
2227
case 'date':

0 commit comments

Comments
 (0)