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

Support archive

Low search using url

ngoncom 1 Apr 2014 16:40 question, complete

Hi Low!

I want using Low Search to count entries from multi category for better performance.

I want an url like that:
http://domain.com/search/results?keywords=''&category='1&2' will return 5 (example).

I cant figure out how can I do this, Low Search beyond my understanding.

Thank Low!

Replies

  1. Low 1 Apr 2014 18:49

    The only way to get the total number of results from a search query, is to use the Results tag and the {absolute_results} variable in it.

    Also, your query string is malformed: the quotes are unnecessary.

  2. ngoncom 2 Apr 2014 07:36

    Hi Low!

    Seem I have missing something. For clearly, I am using Low Search for replace this:

    {exp:channel:entries channel="news" category="1&2"}
    Total entries in both category 1 & 6 is: {absolute_results}
    {/exp:channel:entries}


    Above code give me exactly what I want, but when amounts of entries going up to thousands will causing performance.

    I tried to display Low Search result but not success, here is what I did:

    {if current_query_string == ''}
    {exp:low_search:form}
    <input type="hidden" name="keywords" value="" />
    <input type="hidden" name="category" value="1&2" />
    {/exp:low_search:form}
    {/if}

    {if current_query_string != ''}
    {exp:low_search:results query="{segment_3}"}
    Total entries in both category 1 & 6 is: {total_results}
    {/exp:low_search:results}
    {/if}


    But not luck for me!

  3. Low 2 Apr 2014 07:44

    Are you submitting the form at all? Not seeing a submit button in the form, so it'd be hard to actually submit it.

    Also, are you encoding the query or using GET vars? When using GET vars, you don't need the query="" parameter, only if you're encoding the query.

    You might also want to try using require_all instead of using the ampersand for the category parameter, eg:

    {exp:low_search:form} 
    <input type="hidden" name="category" value="1|2" />
    <input type="hidden" name="require_all" value="category" />
    <button type="submit">Go</button>
    {/exp:low_search:form}

  4. ngoncom 2 Apr 2014 14:00

    I think have to read docs and test again.

    Although, I thank you very much for your help!