Reply To: Issues with categories grouping / filtering

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issues with categories grouping / filtering Reply To: Issues with categories grouping / filtering

#8745
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

Sorry for the late response, I got a bad fever yesterday, could only answer a few simpler threads.

1. I’m not sure if there will be a fix available to automatically parse parent categories for filtering. I see two reasons:
a. Performance. This additional selection would make an incredible performance setback. As opposed to the scenario where the term is simply related to the post object, additional queries are reqired to resolve the parent-child category connections. For each child element per post it means an additional query – growing expontentially.
b. Currently it allows for a child category object not to be related to it’s parent (or in other words not directly related). It can be clearly indicated in the post editor by ticking/unticking the parent category. It’s represented in the database as well. When the parent category is not selected, there is no database record showing the relation between the post and the parent category itself.

I will definitely look into this in more detail, but I’m not sure if it’s doable without creating a huge performance issue.

2. and 3. – You are right. This seems to be an issue with the current release I didn’t know yet. If I unticked anything, then only posts from the ticked categories appear, which is not what is supposed to happen when the “AND” logic is selected.
I even made a second, test search form to confirm it’s not something with the configuration, and it’s not.

I don’t see FTP access to your server, but I could replicate the issue on my test environments and possibly found a solution. I will have to run a lot more tests to confirm, but it appears to be working. If you want to fix it manually, then you need to change the following:

Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\search_content.class.php file on your server and scroll to line 651, which should be this:

$include_cats = count($options[‘categoryset’]) == count($_needed_cat) ? array() : $options[‘categoryset’];

change that line simply to:

$include_cats = array();

Basically, after processing the ticked/unticked/excluded terms, this code part is simplified down to 2 arrays. One is for the terms to exclude, the second is for the ones to include. The first code line above looks like a mistake to me, as it forces to include only elements from the ticked items, which incorrect.

If you want me to help finding/changing this code, feel free to post temporary FTP access and I will do it for you. I hope this helps.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)