From 6a6898ea2b6a61a23875f5b9122d13ba7f4dd2cb Mon Sep 17 00:00:00 2001 From: Seungho Chun Date: Sat, 30 Nov 2024 16:15:02 +0900 Subject: [PATCH] Enhance search functionality with AND-based matching --- src/components/Popup/MainBody.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Popup/MainBody.vue b/src/components/Popup/MainBody.vue index 4e8c4e92d..66e0ab9e4 100644 --- a/src/components/Popup/MainBody.vue +++ b/src/components/Popup/MainBody.vue @@ -96,14 +96,14 @@ export default Vue.extend({ if (this.searchText === "") { return true; } - if ( - entry.issuer.toLowerCase().includes(this.searchText.toLowerCase()) || - entry.account.toLowerCase().includes(this.searchText.toLowerCase()) - ) { - return true; - } else { - return false; - } + + const keywords = this.searchText.toLowerCase().split(" ").filter(Boolean); + + return keywords.every( + (keyword) => + entry.issuer.toLowerCase().includes(keyword) || + entry.account.toLowerCase().includes(keyword) + ); }, clearFilter() { this.$store.dispatch("accounts/clearFilter");