Search results not combining results from a multi-select - %3D appearing in query string
Hi Low,
I've got a search form in EE 2.11.2 and Low Search 4.4.4.
When I search with the following:
- Status multi-select: All statuses selected
- County multi-select: Just Bedfordshire selected
- 2017 Year Status multi-select: 'Registered' and 'Registered - R' selected
I get 10 results, but I'm hoping to get 28 results.
If I do the search again, but with just a status of 'Registered' for the 2017 Year Status field, I get 10 results again (the same 10 results). If I do the search again, but with just a status of 'Registered - R' for the 2017 Year Status field, I get 18 results. So the 10 + 18 makes the 28 I'm hoping for, so how can I get these working in one search?
Looking at the search URLs, I can see this:
mywebsite.com/testing/searches/results?status=Not-Entered|Submitted+for+Review|Registered+-+R|Registered&search:cf_event_county=Bedfordshire&search:cf_event_2017_status=%3DRegistered+-+R|%3DRegistered
Note the %3D's being used on the 2017 Year Status field. If I manually remove them from the URL, the search gives me 28 results as I'm hoping for, e.g.
mywebsite.com/testing/searches/results?status=Not-Entered|Submitted+for+Review|Registered+-+R|Registered&search:cf_event_county=Bedfordshire&search:cf_event_2017_status=Registered+-+R|Registered
Not sure why the %3D's are being added to this custom year status field but not the native status field.
How can I make the search give me the 28 results as standard? I've included a stripped down version of the search form below for info.
Thanks for any help in advance.
Regards,
Stephen
{exp:low_search:form search_mode="all" result_page="/testing/searches/results" secure="no" query="{segment_4}" exact="search:cf_event_town|search:cf_event_county|search:cf_event_laa|search:cf_event_region"}
<label>2018 Status</label>
<select name="status[]" multiple="multiple">
<option value="Not-Entered" selected="selected">Not Entered</option>
<option value="Submitted for Review" selected="selected">Submitted for Review</option>
<option value="Registered - R" selected="selected">Registered - R</option>
<option value="Registered" selected="selected">Registered</option>
</select>
<label>County</label>
<select name="search:cf_event_county[]" multiple="multiple">
<option value="Bedfordshire">Bedfordshire</option>
<option value="Berkshire">Berkshire</option>
<option value="Bristol">Bristol</option>
</select>
<label>2017 Status</label></p>
<p><select name="search:cf_event_2017_status[]" multiple="multiple">
<option value="Not-Entered" selected="selected">Not Entered</option>
<option value="Submitted for Review" selected="selected">Submitted for Review</option>
<option value="Registered - R" selected="selected">Registered - R</option>
<option value="Registered" selected="selected">Registered</option>
</select>
<input type="submit" value="Search »" />
{/exp:low_search:form}
Replies
Low 1 Feb 2018 14:00
The %3D is a URL-encoded = sign, so it looks like you're submitting that along with the value, ie.
value="=Registered"
Also, remove the search_mode="all" parameter (you're not using keywords, nor will it do anything on the Form tag anyway). And move the exact="" parameter to the Results tag (again, won't do anything on the Form tag).
Does that help?
Stephen 1 Feb 2018 14:11
Hi Low,
Thanks for this. You were right when you said I was submitting the equals sign.
I stripped out a lot of the code for the example above (there are about 50 fields in the form otherwise), but the actual code for the 2017 Year Statuses were being pulled in via Low options with this:
<option value="={option:value}">{option:label}</option>
Not sure why I ever put that equals sign in there! I've removed it and it's now working as expected.
Thanks for this,
Stephen
Low 1 Feb 2018 14:13
It would trigger an exact match, but if there are multiple values selected, it would search for the actual string including the equals sign. It's better to use the exact="" parameter instead, which you were already doing.
Stephen 1 Feb 2018 14:15
Thanks Low.