Skip Navigation

[Resolved] Search is using “and” logic instead of “or” logic when options are selected

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a custom field that allows multiple selections. In a custom search View, the filter is combining all the selections using "AND" instead of "OR". I would like to change the search criteria to "OR".

Solution: You can modify the View's Query Filter to accomplish this. Instead of "equal to" you can choose "in" in the custom field comparison options to achieve the results you want.

Relevant Documentation:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#comparison-function

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by debbieM-3 6 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#913490
Screenshot 2018-06-14 09.41.54.png

I am trying to:
The search that I have created has multiple options the user can select. When the results are displayed, I'm getting results using "and" logic instead of "or" logic.

Link to a page where the issue can be seen:
hidden link
I expected to see:
When options are selected, as in screenshot #1, the results should display results with either Single OR Multiple.
Instead, I got:
When options are selected, as in screenshot #1, the search is looking for results with Single AND Multiple.

#913630
Screen Shot 2018-06-14 at 4.40.39 PM.png

Hi, in the Query Filter panel you can modify this behavior for a checkboxes filter. Please see the screenshot attached. You can select "in" instead of "equal to" to allow results that match any of the selected checkboxes.

If you cannot see the Query Filter panel in the View editor screen, scroll to the top of the page and click "Screen Options" in the top right corner. You can enable the Query Filter panel from here.

#914819
913490-Screenshot_2018_06_14_09.41.54.png

Christian, you are the first support person that has actually helped me fix a problem without reducing me to tears of frustration.
Thank you so much.