1

I'm new to Low Search, and i'm trying to get Low Search to work. But when i use the expample codes and after a while of experimenting with some parameters i don't get it to work.

What i noticed is that after i build a index a collection, and when i go directly back to manage collection, i says "Rebuild Index" again.

What do i miss here? Because all i get is - no results.

My test code is pretty simple

Search form:

    {exp:low_search:form 
    collection="nieuws" 
    form_class="navbar-search pull-right" 
    search_mode="any"}
        <input type="text" class="search-query input-small" name="keywords" id="keywords" placeholder="Zoeken">
    {/exp:low_search:form}

Search results page:

    {exp:low_search:results 
    collection="nieuws" 
    search:field="title" 
    loose_ends="yes" 
    query="{segment_3}" 
    search_mode="any" 
    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}Geen resultaten gevonden{/if}
    {/exp:low_search:results}
3

Firstly, check if your collection 'nieuws' has weighted fields. At least one of the fields in the collection should have weight of > 0. A weight of 0 means the field is not added to the index.

Secondly, you can simplify your tags somewhat. You've already got the collection and search_mode parameters set in the Form tag, so no need to repeat them in the Results tag. Also, the search:field="title" seems off to me. That parameter is a native search: parameter and probably does nothing, unless you have a field called field which has the value title. Don't think that's what you're after, so ditch that. Your opening Results tag could simply be this:

{exp:low_search:results query="{segment_3}" limit="10"}

Optionally add the loose_ends parameter to either the Form or the Results tag:

Adding it to the Form tag:

  • Logs the parameter
  • Slightly longer URI

Adding it to the Results tag:

  • Doesn't log the parameter
  • Slightly shorter URI

Edit after taking a look:

Also make sure that the query="{segment_3}" parameter actually points to the encoded query in the URI. Yours was pointing at an empty segment, as your results page URI looks like zoeken/ABC (where ABC is the encoded query), so you needed to change the query parameter to query="{segment_2}".

| improve this answer | |
  • I cleaned up the code but still no results. {exp:low_search:form collection="nieuws" form_class="navbar-search pull-right" loose_ends="yes"} <input type="text" class="search-query input-small" name="keywords" id="keywords" placeholder="Zoeken"> {/exp:low_search:form} {exp:low_search:results query="{segment_3}" limit="10"} {title} {if no_results}Geen resultaten gevonden{/if} {/exp:low_search:results}. What i think it is strange i always asks me to rebuild the index, i thought this is just when you made any changes? – Eddyfever Mar 7 '13 at 11:36
  • True, that shouldn't happen. Send superadmin login credentials to hi at gotolow dot com if you want me to investigate further. – Low Mar 7 '13 at 11:44
  • I created a account for you, it's in your mailbox. – Eddyfever Mar 7 '13 at 13:33
  • Edited answer; added the solution for your issue. – Low Mar 7 '13 at 15:11
  • Thanks for sharing Eddyfever and Low! Low, you are a life saver! Question (probably a stupid one) - how do you added weighted keywords to a collection (as in, how do you add more fields)? – Dan Sep 21 '15 at 10:51
0

I think the parameter search:field="title" is your problem here. The syntax means the the form is searching a custom field you've setup with the name "field" for the text "title."

What you probably want is to search the entry's title for the keyword entered into the {exp:low_search:form}, correct?

Try removing the parameter search:field="title" altogether. You probably don't need to specify searching the title. As long as you don't set the title search weight to '0' in your collection, it will search the title for matching keywords.

If you only want to search entry titles, I think you would use 'search:title' in your form code:

{exp:low_search:form 
collection="nieuws" 
form_class="navbar-search pull-right" 
search_mode="any"}
    <input type="text" class="search-query input-small" name="search:title" id="search:title" placeholder="Zoeken">
{/exp:low_search:form}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.