Background of the issue:
I am experiencing problems with the search on my site; it is very slow and sometimes causes errors that cause the site to crash. I tried to install a plugin to analyze the queries made and identify the cause of the excessive slowness (approximately 30 seconds to load the page) and noticed that the main problem is WPML_Element_Translation->maybe_populate_cache, which performs 3,100 queries to the database.
Symptoms:
The search is very slow and sometimes causes errors that crash the site. The main problem seems to be WPML_Element_Translation->maybe_populate_cache, which performs 3,100 database queries.
Questions:
How can I solve the problem of slow searches?
What can I do to prevent the site from crashing due to this problem?