0

I've got an advanced search set up on my site, using Solspace's Supersearch, in which I'd like to filter the results based on input from multiple checkboxes associated with a single field. The code is based on the following format:

<form method="post" action="{path='search/results'}/" id="adv-form">
<input type="hidden" name="csrf_token" value="{csrf_token}" />
<input type="hidden" name="inclusive_keywords" value="no" />
<input type="hidden" name="redirect_post" value="yes" />
<label><input type="checkbox" name="my_field_name[]" value="value1" />Value 1 </label>
<label><input type="checkbox" name="my_field_name[]" value="value2" />Value 2 </label>
<label><input type="checkbox" name="my_field_name[]" value="value3" />Value 3 </label>
<label><input type="checkbox" name="my_field_name[]" value="value4" />Value 4 </label>
<input type="submit" class="submit" id="submit" name="submit_adv" value="Search Our Directory"/>
</form>

I have entries with "Value 1" checked and no entries with "Value 2" checked. Searching for "Value 1" works, searching for "Value 2" gives me no results which is also fine. The problem is that when both "Value 1" and "Value 2" are checked my results are filtered for "Value 1" when I would expect it to give me no results.

0

Unfortunately, you cannot perform inclusive searches like this on custom fields.

You could achieve inclusive (AND) searches with keyword searches by adding "&&" to each of your values, and in the URI it would show up like: http://site.com/search/results/search?keywords=value1&&value2&&value3

But the above does not work on custom fields yet, so the best it can do right now is "OR" searches: http://www.solspace.com/docs/super_search/search_syntax/#custom_fields

Sorry for the inconvenience

| improve this answer | |
0

I suggest trying out Reefine for this type of functionality. Worked well for me on one site, though I don't know about EE3 compatibility...

http://devot-ee.com/add-ons/reefine

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.