Jump to content

Website has become extremely slow


tires
 Share

Recommended Posts

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");
});

 

  • Like 3
Link to comment
Share on other sites

On 12/18/2024 at 4:23 PM, da² said:

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);

 

I can't really remember why I used this module (it's been a few years).
Do I really need it to find the content of the pages?

You mean I should simply adapt the ready.php to, right?

$wire->addHookAfter('Pages::saveReady', function($event) {
  $event->modules->get('SearchEngine')->indexPages($page);
  $page = $event->arguments(0);
  $event->wire('log')->save('Page saved', "Page ID: $page->id / Page Name: $page->name / Page Parents: $page->parents");
});

Thank a lot!

Link to comment
Share on other sites

6 hours ago, tires said:

Do I really need it to find the content of the pages?

If you have a search page that allows to search text in a lot of pages containing big texts, you probably need it. Do a performance benchmark with and without.

6 hours ago, tires said:

You mean I should simply adapt the ready.php to, right?

Yes but without the mistake you did on the method name. 😁 

Edited by da²
  • Like 1
Link to comment
Share on other sites

On 12/20/2024 at 3:02 AM, da² said:

Yes but without the mistake you did on the method name. 😁 

Which mistake do you mean? 🤓

By the way, do I need this hook at all or does the module automatically index the edited page when it is saved?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...