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

Support archive

' no_results' Tag Shows Output Even With Search Results

Varen Swaab 7 Nov 2016 22:32 problem, complete

I have a simple results tag and search is working just fine. It's showing correct results, the problem is that with each correct search result the no_results tag is also showing content related to the corresponding search result.

For example, if I search for banana and it finds banana the search result tag will also show content saying Banana could not be found, this happens no matter how many search results there are. Here's some code... thank you!

{exp:low_search:results
channel="sightings"
distance:from="{cookie:_lat}|{cookie:_lon}"
distance:to="s_lat|s_lon"
distance:radius="1000"
distance:unit="km"
limit="10"
query="{segment_2}"
}

{paginate}
...
{/paginate}


{low_search_distance} km

<!--/note-footer-->

{if snapshot}{/if}

{title}

{sighting}

{locations
orderby="tag_name" sort="asc"
limit="10"
backspace=""
}
{tag} ({total_entries})
{/locations}
<!-- end:tag -->
<!--/note-body-->



{author}
{entry_date format="%Y %m %d"}

<!--/media-->

<!--/note-content-->

{if count == total_results}
<!--/grid-->
{/if}

{if no_results}

No results for {low_search_keywords}.
{exp:low_search:suggestions keywords="{low_search_keywords}" keywords:lang="en" limit="2"}
{if suggestion_count == 1}Did you mean{/if}
{suggestion}{if suggestion_count != total_suggestions} or {if:else}?{/if}
{if no_suggestions}Check your spelling or try a different search term.{/if}
{/exp:low_search:suggestions}

{/if}

{/exp:low_search:results}

Replies

  1. Low 8 Nov 2016 09:28

    How odd. Have you tried using {if low_search_no_results} instead?

  2. Varen Swaab 8 Nov 2016 18:08

    Yes, I used both tags and the same results happen. Any other ideas? I was a little wrong in my description above because if there are really no results it populates the keyword just fine in the no_results tag but when the no_results tag is showing for correct entries then the keywords are not filled in. I can provide a screenshot or more info if needed. In fact, here's a screenshot... you can clearly see that I'm searching for my name "varen" and it finds an entry with that name but if you look to the side you'll see the "no_results" tag doing its thing. Thanks for helping..

  3. Low 8 Nov 2016 18:33

    Can you share the complete search template, using http://pastie.org/ so the code stays intact (GetSat kind of mangles it)?

  4. Varen Swaab 15 Nov 2016 03:04

    Low,

    Sorry for the lag time. I figured it out and wanted to let you and others know what this problem is in case someone else runs into the same issue.

    I am using Solspaces' Tag module and that module let's you use two alternative ways to display tags in an entry loop:


    {exp:tag:tags} content {/exp:tag:tags}

    OR

    {TAG_FIELD_NAME} content {/TAG_FIELD_NAME}


    Within the low_search:results tag I was using the latter tag format and that's what broke the search results in Low Search. I switched to the original tag format and everything with Low Search worked just fine.

    Just wanted to share, thank you.

    Varen