Performance Tips on Low Search Form
Hello,
I was curious if there were any tips on performance with the Low Search Form tag.
This is by far the fastest search module we've found, and we hit this question out of the reality of searching around 24 possible fields.
The way I have it set up (below) within each field is to have a conditional check to see if the low_search:field_name first has a value. If it does, then it checks the low_options output for the option to select. If there isn't a value in that low_search:field_name then I show raw HTML.
This trick seems to speed up the search, but am curious if there's any other ideas out there when searching across multiple fields. We aren't using keywords, strictly drop downs and fields for entering age, name, etc.
{if low_search_search:skill_level != ''}
{exp:low_options:level_of_experience_search_list parse="inward"}
{options}
{if "{option:value}" !="--"}
<option value="{option:value}"{if option:value == low_search_search:skill_level} selected{/if}>{option:label}</option>
{/if}
{/options}
{/exp:low_options:level_of_experience_search_list}
{/if}
{if low_search_search:skill_level == ''}
<option value="Prospect">Prospect</option>
<option value="Trained">Trained</option>
<option value="Competed & Shown">Competed & Shown</option>
<option value="Champion">Champion</option>
{/if}
Replies
Low 10 Dec 2014 08:23
Well, this is probably because of the 24 Low Options tags. Each tag will have to query the DB to get the details for that field. The only way around that, is to just hard-code the options in your template, which is what you're (partially) already doing.
You could try and replace Low Options with Low List which would be like hard-coding the options, but without the tedious repetition.
As for search results -- all search:field parameters will be put together into one query, so that shouldn't be the bottleneck. You can enable the output profiler and see which queries take the longest, and perhaps apply a database index on the custom fields you query a lot. That could help the lookup as well.
Jordan Sowers 10 Dec 2014 09:50
Thanks for the reply! I had a feeling with 24 options, we would be running into this.