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

Support archive

Search returns everything even entries that don't meet search terms

Sean 27 Nov 2014 19:00 question, complete

EE 2.9.2
LS 3.3.2

This is my first time using Low Search - I'm setting up a branch locator using Google Maps for EE (3.3.8) and currently have two branches in the channel to be searched. I've also set up a select field to search based on a playa field that contains OEM data.

When I select an OEM the page redirects to the search results page but it returns all results. There are only 2 entries currently and each entry has only one OEM so I would expect the search to return one entry.

I was surprised to find that if I do not limit the search to channel="branches" it outputs several empty entries that are unexpected.

My search results tag code is below:

 

{exp:low_search:results limit="10" channel="branches" limit="200" dynamic="no" disable="member_data|comments|pagination"}

{branch_city}

{branch_address}

{branch_city} {branch_province}

{branch_postcode}

Work Phone: {branch_phone}
Toll Free: {branch_toll_free}

Fax: {branch_fax}

{exp:playa:children field="branch_contact" var_prefix="con"}


{exp:ce_img:single var="team_photo" max="100" crop="no" add_dims="no" fallback_src="/images/default-avatar.png"}


{con:team_name}
{encode="{con:team_email}" title="Email Me"}

Show on Map

<!--media-->
{/exp:playa:children}

<!--block cols-->

{/exp:low_search:results}
<!--row-->


In case it's relevant here is my search form

 
By OEM
{exp:low_search:form result_page="branch-locator/filter" form_id="OEM-filter" form_onchange='submit()'}

{exp:channel:entries
channel="branches"
dynamic="no"
orderby="title"
sort="asc"
disable="categories|member_data|pagination|custom_fields"
}
{if count=="1"}All ({total_results}){/if}

{exp:playa:children field="brand_oem" var_prefix="oem" entry_id="{entry_id}"}
{oem:title}
{/exp:playa:children}

{/exp:channel:entries}

{/exp:low_search:form}

Replies

  1. Low 28 Nov 2014 08:34

    Are you using encoded queries or GET vars? If you're using encoded queries, make sure the query="{segment_x}" parameter is set on the Results tag (where x is the encoded query segment).

    If that's not it, can you re-paste your code using http://pastie.org/ or http://pastebin.com/ so it doesn't strip out the html?

  2. Sean 28 Nov 2014 15:45

    Hi Low,

    I tried with and without GET vars without success. Also adding query="{segment_3}" doesn't help - tried with both GET turned on/off (yes I know it's only for when get is turned off)

    My pastie is http://pastie.org/9748798

  3. Low 28 Nov 2014 16:41

    The select element has name="keywords" on it. You'd wanna change that to name="child:branch_oem" or name="child:branch_oem[]" if you're using a multiple-select field.

  4. Sean 28 Nov 2014 17:51

    HI Low,

    I've done both name="child:branch_oem" and name="child:branch_oem[]" and now it outputs a whole series of empty entries.

  5. Low 28 Nov 2014 21:43

    I think the approach might be wrong. What is your channel setup, specifically with relationships, and what are you trying to search? Access to the site might also help to grasp the issue. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.

  6. Sean 29 Nov 2014 13:13

    Low,

    On this page I'm listing all the branches across canada. The search is to retun only branches that carry that particular OEM which is a playa field in the branches channel.

    Have sent login access.

  7. Low 29 Nov 2014 15:15

    FIxed it. You were using encoded queries, so you needed query="{segment_3}" on both the Form and Results tags. Also, the way you generated the OEMs was off. Just output all entries of the OEM channel, instead of listing the brands themselves and using the Playa tags to output the related OEMs per entry (which would also result in duplicate options).

  8. Sean 1 Dec 2014 14:49

    Thanks Low - all working as expected and makes sense. Consider this topic closed.