Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
de54b09
start peggy updates
JS00001 Sep 25, 2025
d9400f9
update peggy parser
JS00001 Sep 25, 2025
663f4cb
fix the negation
JS00001 Sep 25, 2025
28ff212
cleanup logic when building filter value string
JS00001 Sep 25, 2025
99b7f93
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Sep 29, 2025
02a8c34
fix negation not staying as one filter
JS00001 Sep 30, 2025
49538c3
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Sep 30, 2025
5b769f3
update others to use the search ops
JS00001 Sep 30, 2025
b8850ee
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Oct 1, 2025
1e1ea9b
remove logs and fix lint
JS00001 Oct 1, 2025
9aef655
fix tests
JS00001 Oct 1, 2025
f03b92a
fix tests
JS00001 Oct 1, 2025
9b52af1
ugh fix tests again
JS00001 Oct 1, 2025
f46e60b
fix conflicts
JS00001 Oct 1, 2025
db0b029
update for comments
JS00001 Oct 1, 2025
0c4f294
move array outside of the loop
JS00001 Oct 1, 2025
35d2355
regen search parser
JS00001 Oct 1, 2025
5397a7d
fix mobile expensify
JS00001 Oct 2, 2025
92f243f
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Oct 2, 2025
45006f7
add negation checks to the filter bar
JS00001 Oct 3, 2025
b9ef158
fix types
JS00001 Oct 3, 2025
e8aa56f
remove unneeded undefined check
JS00001 Oct 6, 2025
fd5d085
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Oct 6, 2025
ad180ed
start upating buildFilterFormValuesFromQuery to get all matyching vla…
JS00001 Oct 6, 2025
5f87cb7
update method to use new vals
JS00001 Oct 6, 2025
737e8ff
add methods for dates
JS00001 Oct 6, 2025
87b08bc
fiinish rest of filter methods
JS00001 Oct 6, 2025
f4f9799
finish filtering method
JS00001 Oct 6, 2025
71664d8
more explorations of negation
JS00001 Oct 6, 2025
6841870
return negated objects
JS00001 Oct 6, 2025
5c0d222
add negation keys and remove old logic
JS00001 Oct 6, 2025
de7453d
add negations to the addvanced filter form
JS00001 Oct 6, 2025
b49fd11
add non negatable keys
JS00001 Oct 6, 2025
1ed5a99
add negatable keys
JS00001 Oct 7, 2025
d2e1f13
add buildNegationFilterQuery
JS00001 Oct 7, 2025
d41fe59
add negation to query builder
JS00001 Oct 7, 2025
3ab371b
fix negation for building filter strings
JS00001 Oct 7, 2025
a1a63da
remove logs and remove old negation logic
JS00001 Oct 7, 2025
95dbb28
remove duplicate logic
JS00001 Oct 7, 2025
2244eb9
make amount and date negation work
JS00001 Oct 7, 2025
c25da41
fix negation for dates and amounts when buiulding reverse
JS00001 Oct 7, 2025
720c244
remove negatable keys, not needed
JS00001 Oct 7, 2025
4d21207
fix bugs with date and amount
JS00001 Oct 7, 2025
a9dacd1
cleanup comments
JS00001 Oct 7, 2025
c9e048d
Merge branch 'main' of github.com:Expensify/App into jsenyitko-negation
JS00001 Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6708,6 +6708,7 @@ const CONST = {
[this.STATUS.EXPENSE.DRAFTS]: 'draft',
};
},
NOT_MODIFIER: 'Not',
DATE_MODIFIERS: {
ON: 'On',
AFTER: 'After',
Expand Down
13 changes: 2 additions & 11 deletions src/components/Search/SearchPageHeader/SearchFiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ import DateUtils from '@libs/DateUtils';
import Navigation from '@libs/Navigation/Navigation';
import {getActiveAdminWorkspaces, getAllTaxRates, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {isExpenseReport} from '@libs/ReportUtils';
import {
buildFilterFormValuesFromQuery,
buildQueryStringFromFilterFormValues,
buildSearchQueryJSON,
buildSearchQueryString,
isFilterSupported,
isSearchDatePreset,
} from '@libs/SearchQueryUtils';
import {buildFilterFormValuesFromQuery, buildQueryStringFromFilterFormValues, isFilterSupported, isSearchDatePreset} from '@libs/SearchQueryUtils';
import {getDatePresets, getFeedOptions, getGroupByOptions, getGroupCurrencyOptions, getHasOptions, getStatusOptions, getTypeOptions, getWithdrawalTypeOptions} from '@libs/SearchUIUtils';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -254,9 +247,7 @@ function SearchFiltersBar({
updatedFilterFormValues.status = CONST.SEARCH.STATUS.EXPENSE.ALL;
}

const filterString = buildQueryStringFromFilterFormValues(updatedFilterFormValues);
const searchQueryJSON = buildSearchQueryJSON(filterString);
const queryString = buildSearchQueryString(searchQueryJSON);
const queryString = buildQueryStringFromFilterFormValues(updatedFilterFormValues);

close(() => {
Navigation.setParams({q: queryString});
Expand Down
794 changes: 409 additions & 385 deletions src/libs/SearchParser/autocompleteParser.js

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions src/libs/SearchParser/autocompleteParser.peggy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
// Use the `generate-search-parser` and `generate-autocomplete-parser` scripts to regenerate parsers after modifications.
}}
// per-parser initializer (code executed before every parse).
{ let autocomplete = null; }
{
let autocomplete = null;

// List fields where you cannot prefix it with "-" to negate it
const nonNegatableKeys = new Set([
"type", "keyword", "groupCurrency", "groupBy"
]);
}

query = _ ranges:filterList? _ { return { autocomplete, ranges }; }

Expand All @@ -28,12 +35,15 @@ filterList
filter = @(defaultFilter / freeTextFilter)

defaultFilter
= _ key:filterKey _ op:filterOperator _ value:identifier? {
= _ neg:"-"? key:filterKey _ op:filterOperator _ value:identifier? {
expectingNestedQuote = false; nameOperator = false; // Reset string parser

const isNegated = !!neg && !nonNegatableKeys.has(key);

if (!value) {
autocomplete = {
key,
negated: isNegated,
value: "",
start: location().end.offset,
length: 0,
Expand All @@ -43,13 +53,15 @@ defaultFilter

autocomplete = {
key,
negated: isNegated,
...value[value.length - 1],
};
return value
.filter((filter) => filter.length > 0)
.map((filter) => ({
.filter((v) => v.length > 0)
.map((v) => ({
key,
...filter,
negated: isNegated,
...v,
}));
}

Expand Down Expand Up @@ -105,7 +117,7 @@ filterKey
= k:autocompleteKey {
nameOperator = (k === "from" || k === "to" || k === "payer" || k === "exporter" || k === "attendee" || k === "createdBy" || k === "assignee");
return k;
}
}

identifier
= parts:(quotedString / alphanumeric)|1.., ","| empty:","? {
Expand Down
Loading
Loading