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.

strange search behaviour: too many results

November 05, 2012 4:15pm

Subscribe [1]
  • #1 / Nov 05, 2012 4:15pm

    Rob Lyons

    34 posts

    I’ve just gone live with a revamp of my employers’ website:

    http://www.psi.org.uk

    However, the search seems to produce too many results, as if it is searching the whole page rather than the entries. So, for example, a search on

    public views

    produces 101 results (there are 352 entries in the system, so it’s not returning all of them). On many of the pages, the only mention of “public” on the page is in the navigation bar (as part of “publication”) and in a side-advert.

    Here’s the Simple Search template I’m embedding:

    {exp:search:simple_form channel="about|blog|course|event|news|person|publication|research_group|research_project" search_in="entries" where="all"}
          <div class=“searchbox”> Search <div class=“boxes”><div class=“inputbox”><input type=“text” name=“keywords” id=“keywords” maxlength=“100” size=“20”></div><div class=“inputbutton”><input type=“submit” value=“go”></div></div></div>
    </div>
    {/exp:search:simple_form}

    and here is the guts of the Search Results page:

    {exp:search:search_results limit="10" paginate="bottom"}
    {channel}

    {if channel_short_name=="about"}
    {if about_title!=""}{about_title}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="course"}
    {if course_name!=""}{course_name}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="news"}

    {if news_headline!=""}{news_headline}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="event"}

    {if event_title!=""}{event_title}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="publication"}

    {if publication_title!=""}{publication_title}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="research_group"}
    {if research_group_name!=""}{research_group_name}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="research_project"}

    {if research_project_name!=""}{research_project_name}{if:else}{title}{/if}


    {/if}
    {if channel_short_name=="person"}

    {title}


    {/if}
    {if channel_short_name=="blog"}

    {blog_title}


    {/if}

    {paginate}
      {pagination_links}
    {/paginate}
    {/exp:search:search_results}

    I’m currently running 2.4.0 (I know, I know, I’ll update it soon…)

  • #2 / Nov 07, 2012 9:40am

    Robin Sowell

    13255 posts

    Hi Rob,

    I don’t think there’s anything wrong with the search per se (I tried something obscure- decoupling which worked fine, and it’s impossible an EE search is searching the whole page)- but I THINK what’s going wrong is you are searching for all entries with the word ‘public’ or the word ‘view’ in them.  And there are a LOT of articles with one of those words.

    Try specifying an exact match- which will look for ‘public view’ as a phrase, I suspect it will be a much more limited response.  Which- may or may not be how you want to setup your simple search.  But I do think that’s what’s going on with that search.

    That said- if you find an entry without the word public OR view in it?  I can definitely take a closer look.  I failed to in my quick skim.  But there are a lot of results to look at!

  • #3 / Nov 07, 2012 9:48am

    Rob Lyons

    34 posts

    Hi Robin,

    When I didn’t get a reply, I tried changing from “any” to “all” and it certainly seemed to narrow things down, so perhaps that it what it was. I’ll keep an eye on it and return if there appears to be any further apparent strangeness.

    Thanks for getting back,

    Rob

  • #4 / Nov 07, 2012 11:13am

    Robin Sowell

    13255 posts

    Sounds good, Rob.  I’m thinking the search parameters, especially with that particular term, were just too broad.

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

ExpressionEngine News!

#eecms, #events, #releases