All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Empty records returned when searching with blank criteria

Merv 16 Apr 2014 10:35 question, complete

Hi

I am having issues with queries returning empty records when I do not select a city or area. Here is the code snippet:

{exp:low_search:form
collection="wellness_centers"
query="{segment_2}"
result_page="directory/filtered-results-wellness-centers"
form_id="search"
search_mode="all"
}
<div class="block">
<select name="search:wc_city">
<option value="">Any City</option>
<option value="London">London</option>
<option value="Paris">Paris</option>
</select>
<input type="hidden" name="exact[]" value="search:wc_city">
</div>
<div class="block">
<select name="search:wc_area">
<option value="">Any Area</option>
<option value="Kensington">KensingtonStreet</option>
<option value="Holborn">Holborn</option>
</select>
<input type="hidden" name="exact[]" value="search:wc_area">
</div>
...

I think the problem is that the exp_channel_data table is not normalised and causes this problem.

Is there any parameter that could be set in low search to remove empty records from a search that has a "null" criteria such as above ?

Thank you

Merv

Replies

  1. Low 16 Apr 2014 10:44

    Since Low Search 3, all filter-related parameters aren't valid on the Form tag. Instead, set them as input field in the Form tag, or add them to the Results tag. In your case, the collection and search_mode parameters.

    Can you see to what channel these "empty records" belong to? If they belong to a different channel/collection, you should definitely follow the above instructions.

  2. Merv 16 Apr 2014 11:08

    Hi

    Thanks. The empty records belonged to a different channel. The solution has worked, many thanks.

    Merv