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.

Search problems

July 10, 2010 8:16am

Subscribe [3]
  • #1 / Jul 10, 2010 8:16am

    kilbey252

    4 posts

    Hi

    I’ve tried to find a solution to this before but failed.

    My site is a wildlife photography site My Site and I want people to be able to search for images AND get back what they expect.

    This site is currently on 1.6.8 core but I have a licence for 1.6.9 but haven’t upgraded yet (and probably won’t unless I can sort out some of the fundamental problems I’m having with EE - most are probably my inexperience but I’m finding it all a bit of a hard slog and really need to simple things like searching to work before I go any further).

    The problem is this.  If I set the name=“where” to value=“word” it doesn’t respect spaces in search terms (unless you enclose the search term in “”) meaning that a search for RED KITE will return anything with the keyword RED or KITE - erroneous results returned.

    If I set the name=“where” to value=“exact” it hardly does an “exact” filter.  It now respects spaces but searches on parts of words too so that a search for OWL returns any image tagged with the word wildfOWL for example.

    What is the solution?  Am I doing something wrong?  Can you layer attributes to have both “word” and “exact”.

    Code below for search

    Thanks

    Dave Kilbey
    Main search code

    <div id="searchform">
    <form id='searchform' method="post" action="http://www.davekilbeyphotography.co.uk/"  >
    <div class='hiddenFields'>
    <input type="hidden" name="ACT" value="19" />
    <input type="hidden" name="XID" value="51c1d7b2d110e19703e88d86cae5f0883cc37e76" />
    <input type="hidden" name="RP" value="search/results" />
    <input type="hidden" name="NRP" value="search/;no-results" />
    
    <input type="hidden" name="RES" value="90" />
    <input type="hidden" name="status" value="open" />
    <input type="hidden" name="weblog" value="" />
    <input type="hidden" name="search_in" value="entries" />
    <input type="hidden" name="where" value="exact" />
    <input type="hidden" name="site_id" value="1" />
    </div>

    Simple search code

    {exp:search:simple_form search_in="everywhere" no_result_page="search/no-results" status="open" id="searchform" results="90"  where="exact"}
    <div>
    <input type="text" name="keywords" id="search" value="" /> <input type="submit" name="searchBtn" id="searchBtn" value="Search" title="Search" />
    </div>
    {/exp:search:simple_form}

    [Mod Edit: Edited out licence details]

  • #2 / Jul 10, 2010 3:35pm

    Greg Salt

    3988 posts

    Hi Dave,

    The search module seems to be working correctly. You could switch the where parameter to “word” put a message above the search form to the effect that quotes are required to match a phrase like that. You can submit a Feature Request for a change to way that the Search module works. There is also a 3rd party alternative that you may wish to look at.

    Cheers

    Greg

  • #3 / Jul 11, 2010 6:43am

    kilbey252

    4 posts

    Hi

    Thanks for the suggestions.  The ideal short-term solution would be that when people type in a search it automatically gets surrounded by “” when submitted.  Is this possible?  Any ideas how I would do this?

    Thanks
    Dave

  • #4 / Jul 11, 2010 4:47pm

    Greg Salt

    3988 posts

    Hi Dave,

    You would probably need to do this with some Javascript that could change the query before the form is submitted. I can move this thread into the How To forum so that you can get some community input into the best way to do this?

    Cheers

    Greg

  • #5 / Jul 12, 2010 11:41am

    kilbey252

    4 posts

    Hi Greg

    Going back to the original search problem I’m still puzzled how a search for OWL returns images tagged with wildfOWL with

    where="exact"

    set in the form.

    The documentation states:

    exact: only results containing the entire matching phrase will be returned.


    This clearly doesn’t work.  Could it be a problem with the core version?  Might installing 1.6.9 resolve the issue?

    Cheers

    Dave

  • #6 / Jul 13, 2010 7:38pm

    Brandon Jones

    5500 posts

    Dave, please do upgrade to 1.6.9 so we’re on the same page. Now that I reread what you’re experiencing, that behavior does seem strange.

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

ExpressionEngine News!

#eecms, #events, #releases