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

Support archive

Problems implementing keyword search

Merv 16 Apr 2014 14:38 problem, complete

Hi

I am trying to implement a keyword search on my site but I could not get it to work as it keeps giving me the "Sorry, your query did not return any results....". Is there any blatant error in my code ?

This is the code in the search template:

This is the code in the template result page:

Many thanks

Merv

Replies

  1. Merv 16 Apr 2014 14:40

    Hi

    I am not sure if the code has showed up on in the question box above. Here it is in plain text:

    This is the code in the search template:

    {exp:low_search:form
    collection="lead_article|second_col_article|first_col_article"
    query="{segment_2}"
    result_page="search-results-articlesv2"
    required="keywords"
    form_id="search"
    search_mode="all"
    }
    <fieldset>
    <input type="search" name="keywords" id="keywords" placeholder="Search articles..">
    {if low_search_keywords_missing} Please enter keywords{/if}
    <button type="submit" class="btn btn-mbg-blue">Search</button>
    <input class="form-inline" type="hidden" id="searchaction" value="submit">
    </fieldset>
    {/exp:low_search:form}


    This is the code in the template result page:

    {exp:low_search:results
    query="{segment_3}"
    status="not closed"
    disable="member_data|category_fields"
    paginate_base="search-results-articlesv2/{segment_3}" limit="5"
    collection="lead_article|second_col_article|first_col_article"
    search_mode="all"

    }
    <a href="{url_title_path=article/posts}"><font size="4">{title}</font></a>
    {paginate}
    <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
    {if low_search_no_results}
    <p>
    Sorry, your query did not return any results.<br>
    Try searching with fewer criteria by selecting (<i>Any day</i> or <i>Any time</i>) instead of a specific day or time.
    </p>
    {/if}
    {/exp:low_search:results}



    Many thanks

    Merv

  2. Low 16 Apr 2014 16:05

    First of all, remove the collection and search_mode parameters from the Form tag, because they have no effect. Leave them on the Results tag.

    Have you added weight greater than 0 to the collection fields? They need to be, or they won't get added to the index.

    (and try using the <pre> tag for displaying code here)

  3. Low 16 Apr 2014 16:11

    Also, the query="" parameter in your Results tag should point to the encoded query in the URI. Your result_page is "search-results-articlesv2" so I reckon you should change the param in your Results tag to query="{segment_2}".

  4. Merv 16 Apr 2014 17:55

    Working well now. Thank you.