Low Search Results Variables not Rendering
Hey, so far I am really enjoying this module. It is much better than the native EE search module.
Anyway, I have a fairly vanilla search template that looks like this:
{Header}
{exp:low_search:form query="{segment_3}" require_all="category"}
<fieldset>
{if error_message != ''}
<p class="error">{error_message}</p>
{/if}
<input type="search" name="keywords" placeholder="Keywords" value="{keywords}" />
<label>
<input type="checkbox" name="loose_ends" value="yes"
{if loose_ends == 'yes'} checked="checked"{/if} /> Fuzzy search
</label>
<select name="search_mode">
<option value="any"{if search_mode == 'any'} selected="selected"{/if}>Any word</option>
<option value="all"{if search_mode == 'all'} selected="selected"{/if}>All words</option>
<option value="exact"{if search_mode == 'exact'} selected="selected"{/if}>Exact phrase</option>
</select>
{collections show="not private_collection"}
<label>
<input type="checkbox" name="collection[]" value="{collection_id}"
{if collection_is_active == 'y'} checked="checked"{/if} /> {collection_label}
</label>
{/collections}
Categories <select name="category[]" multiple="multiple">
{exp:channel:categories channel="my_channel" style="linear"}
<option value="{category_id}"{if category_id IN ({low_search_category})} selected="selected"{/if}>
{category_name}
</option>
{/exp:channel:categories}
</select>
<button type="submit">Search</button>
</fieldset>
{exp:low_search:results query="{segment_3}" limit="10" status="not closed"}
{if count == 1}
<p>
{if low_search_keywords}Searched for <strong>{low_search_keywords}</strong>.{/if}
Total results: <strong>{absolute_results}</strong>.
</p>
{/if}
<div class="entry">
<h2>{title}</h2>
<p>Found in {low_search_collection_label} with a score of {low_search_score}.</p>
<p>{low_search_excerpt}</p>
<p><a href="{comment_url_title_auto_path}">{comment_url_title_auto_path}</a></p>
</div>
{if no_results}
<p>
Sorry, your query did not return any results.
Check your spelling or try a different search term.
</p>
{/if}
{paginate}
{pagination_links}
<ul>
{first_page}
<li><a href="{pagination_url}" class="page-first">First Page</a></li>
{/first_page}
{previous_page}
<li><a href="{pagination_url}" class="page-previous">Previous Page</a></li>
{/previous_page}
{page}
<li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
{/page}
{next_page}
<li><a href="{pagination_url}" class="page-next">Next Page</a></li>
{/next_page}
{last_page}
<li><a href="{pagination_url}" class="page-last">Last Page</a></li>
{/last_page}
</ul>
{/pagination_links}
{/paginate}
{/exp:low_search:results}
Show <select name="limit">
<option value="2"{if low_search_limit == "2"} selected="selected"{/if}>2</option>
<option value="10"{if low_search_limit == "10"} selected="selected"{/if}>10</option>
<option value="25"{if low_search_limit == "25"} selected="selected"{/if}>25</option>
<option value="50"{if low_search_limit == "50"} selected="selected"{/if}>50</option>
</select> results per page
{/exp:low_search:form}
{Footer}
The issue I am having is that the only things that are rendering inside of {exp:low_search:results} are the {title} and the {comment_url_title_auto_path}. I can render the custom fields I have added to the channels I am searching but I would prefer to use {low_search_excerpt}. My solution for now is to put the variable for each {low_search_excerpt} for each channel so {chan1content}{chan2content}{etc}.
Since I can't render the excerpt at this point I was wondering if the {low_search_excerpt} does something like google search where it only shows a small blurb of text that contains the keywords?
Replies
Low 6 Mar 2012 22:00
I think the problem here is nesting the low_search:entries tag inside the low_search:form tag. Can you try un-nesting the two tags and see if that solves the rendering issue?
jlkalberer 9 Mar 2012 18:05
Yes, that fixes it although I set up the form like this so I could put the page size after the results...
Thanks.