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

Support archive

i don't get it. I get no search results and i don't really know why...

PeterGeller 27 Jun 2012 18:52 problem, complete

Everytime when i submit an empty field i get back every entry inside my database, but when i try to search for a keyword i get no results:

This is my form:

 
<!-- Search box -->
{exp:low_search:form collection="news|employees|pressemeldung" search_mode="all" result_page="{site_url}suchergebnisse/"}
<fieldset>
<input type="search" name="keywords" placeholder="Platzhalter" id="keywords" />
<button type="submit">Search</button>
</fieldset>
{/exp:low_search:form}
<!-- Search box -->

and this is my result code inside the template suchergebnisse, segment_2 is the url search string:
 
{exp:low_search:results query="{segment_2}" limit="10"}

{if count == 1}
<p>
{if low_search_keywords}Gesuchte wurde nach <strong>{low_search_keywords}</strong>.{/if}
Suchergebnisse: <strong>{absolute_results}</strong>.
</p>
{/if}

<br>
<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>

{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}

{if no_results}
<p>
Entschuldigung, Ihre Suchanfrage gab keine Ergebnisse.<br />
Überprüfen Sie nochmal Ihre Schreibweise oder probieren Sie einen anderen Suchbegriff.<br />
{low_search_keywords}
</p>
{/if}

{/exp:low_search:results}

What also would be really great if there where more different examples for a plugin, or maybe i'm to stupid to understand it!

Thx Peter

Replies

  1. Low 27 Jun 2012 20:20

    Hi Peter,

    A keyword-less search would return all entries, as there is no keyword to filter the entries by. So that's intended behavior. If you don't want to allow keyword-less searches, you can add the parameter required="keywords" to the low_search:form tag.

    As for no results for searches with keywords: have you built the indexes for the collections you're searching? Can you make sure the words you're searching for actually exist (ie. the fields have weight > 0) in the index? Also, how many entries are you indexing?

    You can also turn on Template Debugging and look up the lines starting with Low Search to see what the module is doing.

  2. PeterGeller 28 Jun 2012 07:23

    Must i build indexes to get a search result? I thought the index is only to make the output faster. The thing i want to use it to did a global search of all important channels. I tried it for the first 3 channels but maybe i did something wrong.

    The word really exists and i try some others too.
    At the moment the site is in development and has only 111 entries.

    When i turn template debugging on, i get no results, only an timezone error, which i want to fix in the next hour, but i'm not our server admin :-)

    Is there anything else i can do?

  3. PeterGeller 28 Jun 2012 07:41

    Ok, i built now indexes, but again i get no results for news, or any other collection :-(

  4. Low 28 Jun 2012 07:51

    If you want keyword searches, then you do need to index your collections. Can you post a screenshot of your collection details?

  5. PeterGeller 28 Jun 2012 07:59

    Ok, i got it :-) It was the weight.
    Some last questions:

    Do i have to set always a weight>0?
    Do i have to rebuild the channel everytime when i update my entries collection?
    To debug the template and to see the output of the low search module, do i have to set only the debug var for the index.php of ee or is there anythign else i have to set?

    Thank you

    Peter

  6. Low 28 Jun 2012 08:04

    Always set a weight > 0 when you want to include the field in the search index. That means you can create multiple collections per channel, allowing for weighing different fields (think multi-language here).

    No, once built, a collection index will stay up to date. Only rebuild when you change the weight of the fields.

    You can turn on template debugging under Admin ‣ System Administration ‣ Output and Debugging, see also http://expressionengine.com/user_guid...

  7. PeterGeller 28 Jun 2012 11:10

    Thank you!

    Nice plugins by the way!