Date search loading time


I am facing a similar issue as the below:
Date availability search performance - General - HivePress Community

Whenever I search based on a date range, it takes 30 seconds or more to display the results.
For a comparison a search without a date range would take 2-3 seconds max.

Another problem is that, once it has displayed the results from the date search and say, you want to go to the second page. It takes another 30 seconds or more to show the results on the second page.

@notesow would you be able to share if you managed to fix your problem?
I believe it is the same issue.

@ihor @andrii would you be able to share how the date based search works?
And if you have an idea about how to change it or improve it to reduce the loading time to a minimum.

Thank you for the help in advance!


This search also depends on the server response time. The server response time depends on many factors, e.g., your hosting plan (we recommend the VPS), other installed plugins (each plugin may slow down the site), customizations, the number of users and listings, caching (try setting up Litespeed), etc. - if you’re familiar with website setup, I recommend going through all the possible issues.
Also, I recommend looking at the wp_post table, how many entries you have there, etc.

​I hope this is helpful to you.

thank you Andrii, I will definitely explore all the possibilities.

In the below comment from Ihor he is mentioning that you were planning to optimise it by auto-generating lookup tables, has this been implemented?
If not, would you be able to share the code of how it is currently done?

“if you search by both location and dates the query is pretty complex since it performs a radius-based search (by latitude/longitude) and date availability search (by comparing date ranges). We plan to optimize it in future updates by auto-generating lookup tables instead of querying the wp_posts one.”

Unfortunately there’s no such feature yet but we plan to implement it. This required advanced customizations, to create and sync the lookup tables on every listing update.

understood, would you please share with me where I can find the source code for the wp_post query?
I would like to try and disable it and then make the customisation myself.

Sorry for the delay. We use the pre_get_posts hook to alter the default WordPress search query If you mean replacing it completely and creating/using lookup tables instead, this would require advanced customizations for sure.

Hope this helps.

Thank you Ihor, appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.