Reply To: AND Logic Operator not working properly

Home Forums Product Support Forums Ajax Search Pro for WordPress Support AND Logic Operator not working properly Reply To: AND Logic Operator not working properly


Ernest Marcinko

Hi Stem,

If I understand correctly you are reffering to the category filter operator:
Please correct me if I’m wrong. In your case however that operator is not in use, because that is to set how the comparision should be made between different taxonomy groups. Since you use only one taxonomy (post categories) as filter, that does not affect the outcome. The rest of the configuration looks okay on that page.

I believe you want to display results from those categories visible in the front-end filter? So basically results from ‘Sex’ and ‘Who is’ main and sub categories, based on selection. The problem here is that there are many other categories, and unless the search is told excplicitly to ignore those, it will still include them as results, since the categories in the filter have no connection with the items in the other categories. Basically items not affected by the chosen category filters will still be visible as results. In most use-cases this is an expected behavior, that is why it’s set as default.

To change that, there are thre possible solutions:
1. Change the individual term logic to ‘At least one selected term should match’:
This is different in a sense that at least one of the choosen terms has to match. However this is possibly not the best solution.

2. To tell the search which categories to restrict the results to. In your case it would be ‘Sex’ and ‘Who is’ and all of the desired sub categories you want. You can configure this on the Advanced Options -> Exclude results panel:
This will only allow results from categories which match any of the selected categories.

3. Similarly to solution 2., it is possible to excplicitly define which categories to exclude (just above the previous ‘include’ option):
This is the most strict option, as similarly, if any of the items match any of the selected categories, it is automatically excluded.

Depending on your requirements, I would recommend either solution 2 or solution 3, or combination of the two.

Ernest Marcinko

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