How to filter entries by multiple checkbox field types I've set up checkbox fields for photos in a photo gallery called &quot;photoColor&quot;, &quot;photoSubject&quot;, and &quot;photoSize&quot;, all of which contain a bunch of options.
On the gallery page I have filters and I'm using Ajax to update the page when a checkbox is clicked.
&lt;div id=&quot;filters&quot;&gt;
 &lt;input type=&quot;checkbox&quot; name=&quot;colors[]&quot; value=&quot;red&quot; /&gt; Red
 &lt;input type=&quot;checkbox&quot; name=&quot;colors[]&quot; value=&quot;green&quot; /&gt; Green

 &lt;input type=&quot;checkbox&quot; name=&quot;subjects[]&quot; value=&quot;human&quot; /&gt; Human
 &lt;input type=&quot;checkbox&quot; name=&quot;subjects[]&quot; value=&quot;animal&quot; /&gt; Animal

 &lt;input type=&quot;checkbox&quot; name=&quot;sizes[]&quot; value=&quot;small&quot; /&gt; Small
 &lt;input type=&quot;checkbox&quot; name=&quot;sizes[]&quot; value=&quot;large&quot; /&gt; Large
&lt;/div&gt;

I'm gathering the values of the checkboxes like this
  var colors = [], subjects = [], sizes = [];
  $('input[name=&quot;colors[]&quot;]:checked').each(function() {
     colors.push($(this).val());
  });

  $('input[name=&quot;subjects[]&quot;]:checked').each(function() {
     subjects.push($(this).val());
  });

  $('input[name=&quot;sizes[]&quot;]:checked').each(function() {
     sizes.push($(this).val());
  });

Right now I can filter for one option of one field type, i.e. this works:
{%  set galleries = craft.entries.section(&quot;gallery&quot;).photoColor(value) %}

(where value = &quot;red&quot; for example)
But I'm struggling to figure out how to write the query to combine ALL 3 field types in an &quot;or&quot; query, i.e. the results only need to match one of those properties, not all of them.
In other words, if a user checks off red, green, animal, and small, it will show all the results matching either red, green, animal, OR small - not just red/green animals that are small.
In pseudo code, it would be something like:
{% set galleries = craft.entries.section(&quot;gallery&quot;)
  where .photoColor is red or green
   or .photoSubject is animal
   or .photoSize is small
%}

I've been searching StackExchange and trying things I saw in other answers for days, but none of the situations were quite like mine, so I haven't been able to get it to work. Can someone point me in the right direction? Any help is greatly appreciated.
Apologies if I’ve misunderstood your question and over-simplified things, but wouldn’t the search() method give you precisely what you need?
As in:
{% set valsToFind = &quot;field_photoColor:red OR field_photoColor:green OR field_photoSubject:animal OR field_photoSize:small&quot; %}
{% set galleries = craft.entries.section(&quot;gallery&quot;).search(valsToFind).all() %}