refactor: Implement new preprocessor for Boolean searches #2758
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Note: this is labelled as a refactor as the new code is not yet used in the Tasks plugin.
This extends
BooleanPreprocessor
to add a more sophisticated implementation for preprocessing Boolean/combined filters.BooleanPreprocessor.preprocessExpression()
This change - and especially the new method
isAFilter()
- is the result of several weeks and many, many hours of trying to maintain existing working searches, whilst also adding support for filters that contain the following characters:(
)
"
Caveats
The one current caveat with this implementation is that it does not work for filters the end with any of the characters
()"
, as they are swallowed up and treated as delimiters.So for example, this filter:
is interpreted as this simplified line - note the stray
"
:where
f1
is this - note the missing"
:Motivation and Context
Likely the last refactor before addressing:
How has this been tested?
BooleanField.test.boolean_query_-_exhaustive_tests_preprocess.approved.txt
BooleanField.test.boolean_query_-_exhaustive_tests_preprocess_-_rewrite.approved.txt
Screenshots (if appropriate)
Types of changes
Internal changes:
refactor
- non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)test
- additions and improvements to unit tests and the smoke tests)Checklist
yarn run lint
.Terms