-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Fixes #9799] Thesaurus selectbox performance in metadata editor is very slow #9800
Conversation
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.
Hi, @mwallschlaeger I see that no tests are added, the old ones are still valid? Or do they need some improvement?
(I'm asking since the build was failing :) )
Codecov Report
@@ Coverage Diff @@
## master #9800 +/- ##
==========================================
+ Coverage 61.33% 61.35% +0.01%
==========================================
Files 822 822
Lines 50277 50298 +21
Branches 7748 7745 -3
==========================================
+ Hits 30837 30858 +21
Misses 17760 17760
Partials 1680 1680 |
update master
merge master
OOOK. The main problem with the languages is that in django shell in django.utils.translation.get_language() returns "en" but if django.utils.translation.get_language() got executed via the browser you get a language including the country like "en-us". Therefore, i added a function which removes the country code. Sadly there is no function in the django translation module which reliable returns the language without country code. So the search functions in geonode.base.view and geonode.base.form now try to first find entries with language code including the country, because for some languages this makes sense. If no entries are found for this, we change the language to only include the language ("en"). And if this results still contain nothing geonode shows the alt_labels. I also added some tests which set the language with and without country code and try to get results from the _get_thesauro_keyword_label function in ThesaurusAvailableForm. In current implementation geonode always returns alt_labels because its not able to handle the language_code including country code ... |
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.
overall looks ok, there is just an issue with the flake8 formatting. Can you please fix it so the CircleCI test will run?
…ery slow (#9800) * [Fixes #9799] Thesaurus selectbox performance in metadata editor is very slow Co-authored-by: mattiagiupponi <[email protected]>
…ery slow (#9800) (#9836) * [Fixes #9799] Thesaurus selectbox performance in metadata editor is very slow Co-authored-by: mattiagiupponi <[email protected]> Co-authored-by: Marcel Wallschläger <[email protected]>
References: #9799
As described in the issue. The requests to the database are very slow. This is basically related to a for loop used in the current implementation. To evaluate my changes i wrote a small benchmark to show the performance improvements done by this commit.
When i run the script with the agrovoc loaded into the database (https://github.com/zalf-rdm/geonode-agrovoc-importer) on my Desktop PC i get the following results:
So the new implementation is something like 400 times faster than the current implementation.
In my opinion the way of handling alt_labels so labels which are not available in the current language could also be improved.
Checklist
For all pull requests:
The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):
Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.