ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Get true total count - absolute_results issue with limit

April 14, 2011 11:38am

Subscribe [1]
  • #1 / Apr 14, 2011 11:38am

    eggsurplus

    1 posts

    I’m trying to implement a search and it works so far except I need to return the total result count. Right now absolute_results gets limited to the limit that is passed through.

    <?xml version="1.0" encoding="UTF-8"?>
    <news>
    {exp:search_fields 
        search:title="{embed:search}" 
        search:news_article="{embed:search}" 
        operator="OR" 
        channel="news" 
        parse="inward"}
    
        {exp:channel:entries entry_id="{search_results}" orderby='date' dynamic='no' sort='desc' limit='{embed:limit}' offset='{embed:offset}'}
        {if count == "1"}<totalresults>{absolute_results}</totalresults>{/if}
        <entry>
            <id>{entry_id}</id>
            <title>{title}</title>
            <teaser>{news_teaser}</teaser>
            <article>{exp:xml:encode}{news_article}{/exp:xml:encode}</article>
            <start_date>{entry_date}</start_date>
            <expiration_date>{expiration_date}</expiration_date>
            <featured_start_date>{news_featuredstartdate}</featured_start_date>
            <featured_end_date>{news_featuredenddate}</featured_end_date>
            <categories>{categories}
                <category id='{category_id}' name='{exp:xml:encode}{category_name}{/exp:xml:encode}'>
            {/categories}</categories>
        </entry>
        {/exp:channel:entries}
    {/exp:search_fields}
    </news>

    Ideas on how to get the true total count?

    Here is the embed page:

    {embed="news/search_new" search='{exp:get_parameters get="search"}' limit='{exp:get_parameters get="limit"}' offset='{exp:get_parameters get="offset"}'}
  • #2 / Apr 14, 2011 4:51pm

    eggsurplus

    1 posts

    Looking at the search_fields plugin it looks like this will become inefficient as more content gets added. How would I do something similar to this using the built-in search capability. I don’t want to use the search form but want to be able to search.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases