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

Support archive

404 Error when search URL contains parameter

jmorton 26 Jun 2012 14:34 problem, rejected

I have Low Search set up on my site such that the form is at /forms/search/


{exp:low_search:form collection="scl_products" search_mode="all" result_page="/search" site_id="1" loose_ends="yes"}
<fieldset>
<label for="keywords">Keywords</label>
<input type="search" name="keywords" id="keywords" />
<button type="submit">Search</button>
</fieldset>
{/exp:low_search:form}


and the search results page is at /search


{exp:low_search:results query="{segment_4}" limit="10"}
{if count == 1}<ol>{/if}
<li><a href="{comment_url_title_auto_path}">{title}</a></li>
{if count == total_results}</ol>{/if}
{if no_results}No search results{/if}
{/exp:low_search:results}


When I submit the form at /forms/search/, it correctly directs me to /search/YTo0OntzOjg6ImtleXdvcmRzIjtzOjExOiJjZXJ0aWZpY2F0ZSI7czoxMToic2VhcmNoX21vZGUiO3M6MzoiYWxsIjtzOjExOiJyZXN1bHRfcGFnZSI7czo3OiIvc2VhcmNoIjtzOjEwOiJsb29zZV9lbmRzIjtiOjE7fQ/ or something similar. But instead of getting search results I get "Sorry, page not found. Please update the templates/layouts/404.html file and provide a useful 404 page." If I delete the long hash so that I'm just at /search/ then I get "No search results". Any idea what would be going on here? It's as though EE is confused that the long hash might be a standard page that I'm trying to access, no? Are there other add-ons that you know of that don't play well with Low Search?

Thanks

Replies

  1. Low 26 Jun 2012 17:49

    The result_page parameter should point to the template or page where the search results tag is located. The encoded search query is appended to it an you can use a segment var to pass that to the query="" parameter of the low_search:results tag.

    You're passing {segment_4} to it, which is empty based on the URL you mentioned. Make sure the paths are correct.

  2. jmorton 26 Jun 2012 20:44

    Thanks for the quick reply. After confirming things were set up correctly, I began to think about how I'd set up the Search page's URL (/search/) via Structure. If I take the page out of Structure and instead define the search results page to use /layouts/specialized_search instead, then I'm getting the expected behavior. So it seems like I just need to keep the search results page outside of Structure.

    Thanks