Question about searches with multiple queries and using Advanced Custom Fields
I have a site that has about 3000 items in a custom post type. We've used Advanced Custom Fields to create some categories for each item in the CPT. The client wants to have a filter system to search for items in the CPT. There are 3 main sets of options. Each set has about 7 checkboxes in the search form. This creates quite a complex query because they want to use an "OR" condition inside each set of options and the and "AND" condition betwen the sets. So the customer gets option A, or option B from set 1 and option C or option D from set 2. Hope this makes sense.
When I tried to do this with WP Query, the query took a crazy amount of time to complete. I saw a number of articles on the web where it was mentioned that using lots of meta and taxonony options to WP Query slows it way down.
Will your plugin help with situations like this? Right now, I'm using a static JSON feed of all the products and just creating arrays of post ID's to use. One I get all the ID's that I need, I pass them into a WP Query to get the posts.
Let me know what you think and thanks in advance!
Yes it makes sense – your customer wants faceted search – it’s a normal requirement but something that unfortunately can prove difficult from a performance point of view. Rest assured I love solving these kind of performance problems, so if somehow Scalability Pro doesn’t already solve it I will add code to solve it for you.
Yes – it has built in sections to improve WP_Query – depends what you want to do with it –
For example, there is an option to switch off WP_Query pagination – to do this you need to use infinite scroll, but the boost it gives you is that the single table scan normally required to count the total items (and hence total pages) is no longer required and you get milliseconds response speed instead of whatever dreadful speed you are getting.