-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form filter: filter autocomplete list based on previous applied filters #5045
base: master
Are you sure you want to change the base?
Form filter: filter autocomplete list based on previous applied filters #5045
Conversation
ad438a9
to
6f17feb
Compare
Nice addition. Related to form_filter, is there any chance we can remove the manual test about the "form filter" at the same time, as you moved from Cypress to Playwright ? https://github.com/3liz/lizmap-web-client/blob/master/tests/qgis-projects/tests/form_filter.md (maybe with the help of echoproxy ?) |
Done bae3440 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the removal of the manual test ... :)
This PR changes the behaviour of the form filter. Previously, all unique values from the text field (with the autocompletion activated) were downloaded once at startup. Now, every time the user types letters, a new request is triggered with the given filter and the It is more dynamic and better than before, but I think we should test it against a big dataset to evaluate the performance. |
Co-authored-by: Étienne Trimaille <[email protected]>
I've tested with 1 100 000 lines inserted with: INSERT INTO tests_projects.form_filter (label, geom)
SELECT
md5(random()::text),
null
FROM generate_series(1, 1000000); Request made to get values when typing 'abc' returns in 800ms. 'abcd' or 'abcde' in 300ms. |
great. Have you tried by using the following index CREATE EXTENSION IF NOT EXISTS pg_trgm;
DROP INDEX IF EXISTS test_index;
CREATE INDEX test_index ON tests_projects.form_filter USING GIN (label gin_trgm_ops); |
Now request made to get values when typing 'abc' returns in 500ms. 'abcd' or 'abcde' in 100ms. |
if (!globalThis['filterConfigData'].filter) { | ||
sdata.filter = autocompleteFilter; | ||
} else { | ||
sdata.filter = globalThis['filterConfigData'].filter + ' AND ' + autocompleteFilter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generated filter can contain OR terms. We should use parenthesis to ensure the correct logic will be used. Spaces are used around them to please QGIS :
sdata.filter = globalThis['filterConfigData'].filter + ' AND ' + autocompleteFilter; | |
sdata.filter = ' ( ' + globalThis['filterConfigData'].filter + ' ) AND ' + autocompleteFilter; |
This PR changes the behaviour of the form filter. Previously, all unique values from the text field (with the autocompletion activated) were downloaded once at startup. Now, every time the user types letters, a new request is triggered with the given filter and the LIKE and fetches all corresponding data.
Funded by VSB
simplescreenrecorder-2024-12-03_10.51.09.mp4