From 645c6764d432825830f1dbe8fb5016b9185f3523 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Mon, 8 Sep 2025 08:03:40 -0400 Subject: [PATCH 1/3] fix bug --- src/libs/SearchQueryUtils.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 920053a78a46..7931c1e065e8 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -306,18 +306,28 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea // actually filter out results const similarSearchIgnoredFilters = new Set([CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY]); + // Certain filte + const similarSearchValueBasedFilters = new Set([CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION]); + query.flatFilters .map((filter) => { - if (!similarSearchIgnoredFilters.has(filter.key)) { - filterSet.add(filter.key); - } - + const filterKey = filter.key; const filters = cloneDeep(filter.filters); filters.sort((a, b) => customCollator.compare(a.value.toString(), b.value.toString())); - return buildFilterValuesString(filter.key, filters); + return {filterString: buildFilterValuesString(filterKey, filters), filterKey}; }) .sort() - .forEach((filterString) => (orderedQuery += ` ${filterString}`)); + .forEach(({filterString, filterKey}) => { + if (!similarSearchIgnoredFilters.has(filterKey)) { + filterSet.add(filterKey); + } + + if (similarSearchValueBasedFilters.has(filterKey)) { + filterSet.add(filterString); + } + + return (orderedQuery += ` ${filterString}`); + }); const similarSearchHash = hashText(Array.from(filterSet).join(''), 2 ** 32); const recentSearchHash = hashText(orderedQuery, 2 ** 32); From 4e36238be1a248587cfa43bf4cda3cb20101b465 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Mon, 8 Sep 2025 08:04:45 -0400 Subject: [PATCH 2/3] add comments --- src/libs/SearchQueryUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 7931c1e065e8..7398fb1d2f4b 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -306,7 +306,8 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea // actually filter out results const similarSearchIgnoredFilters = new Set([CONST.SEARCH.SYNTAX_FILTER_KEYS.GROUP_CURRENCY]); - // Certain filte + // Certain filters' values are significant in deciding which search we are on, so we want to include + // their value when computing the similarSearchHash const similarSearchValueBasedFilters = new Set([CONST.SEARCH.SYNTAX_FILTER_KEYS.ACTION]); query.flatFilters From 1db02a52b8a16a38ba259c4762ac02d57e2f85a9 Mon Sep 17 00:00:00 2001 From: Jack Senyitko Date: Wed, 10 Sep 2025 07:57:30 -0400 Subject: [PATCH 3/3] address comments --- src/libs/SearchQueryUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 7398fb1d2f4b..d6758afa0cd5 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -317,17 +317,17 @@ function getQueryHashes(query: SearchQueryJSON): {primaryHash: number; recentSea filters.sort((a, b) => customCollator.compare(a.value.toString(), b.value.toString())); return {filterString: buildFilterValuesString(filterKey, filters), filterKey}; }) - .sort() + .sort((a, b) => customCollator.compare(a.filterString, b.filterString)) .forEach(({filterString, filterKey}) => { if (!similarSearchIgnoredFilters.has(filterKey)) { filterSet.add(filterKey); } if (similarSearchValueBasedFilters.has(filterKey)) { - filterSet.add(filterString); + filterSet.add(filterString.trim()); } - return (orderedQuery += ` ${filterString}`); + orderedQuery += ` ${filterString}`; }); const similarSearchHash = hashText(Array.from(filterSet).join(''), 2 ** 32);