tires Posted yesterday at 10:43 AM Share Posted yesterday at 10:43 AM I have a site with about 5000 subpages and have noticed that it now takes about 10 seconds to save a page. What could be the reason for this and how can I speed up the site? Link to comment Share on other sites More sharing options...
AndZyk Posted yesterday at 10:58 AM Share Posted yesterday at 10:58 AM Hello @tires, have you tried looking in TracyDebugger if there is an error? Do you use hooks or special modules? The amount of subpages should not be an issue in my experience. Maybe there is something else going on. Regards, Andreas 1 Link to comment Share on other sites More sharing options...
tires Posted yesterday at 11:54 AM Author Share Posted yesterday at 11:54 AM Thank you very much for your advice! I have indeed found a hook that was apparently to blame. I can't remember exactly why I added it and what it does ... $wire->addHookAfter('Pages::saveReady', function($event) { $event->modules->get('SearchEngine')->indexPages(); $page = $event->arguments(0); $event->wire('log')->save('Page saved', "Page ID: $page->id / Page Name: $page->name / Page Parents: $page->parents"); }); 2 Link to comment Share on other sites More sharing options...
da² Posted 23 hours ago Share Posted 23 hours ago 2 hours ago, tires said: $event->modules->get('SearchEngine')->indexPages(); You are indexing all the site pages every time a page is saved. You should index only this page since the work for other ones was already done. 2 Link to comment Share on other sites More sharing options...
AndZyk Posted 23 hours ago Share Posted 23 hours ago Happy to hear you found the issue. 😀 You could consider indexing the pages with a Lazy Cron or a cronjob. 2 Link to comment Share on other sites More sharing options...
da² Posted 22 hours ago Share Posted 22 hours ago Solution is here: https://processwire.com/modules/search-engine/ // Alternatively index just a single page (passing in a Page object): $modules->get('SearchEngine')->indexPage($page); 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now