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

Support archive

Low search, can't filter via single number custom field

Tom Carwardine 4 Oct 2013 12:30 question, complete

I've just purchased low search and have set it up to work how we want but have a remaining issue that seems to make no sense.

We're searching properties and need to filter via bedrooms, this is set as a custom field in the channel named bedrooms (dropdown field, 1-10 numbers).

In this form we're using keyword less search and have various selects with names to match the custom fields.

I have the other parameters working fine (an area and a price from and to) but bedrooms doesn't narrow the results.

I can see in the search log that the parameter is getting through, so the module is expecting it but not using it to query like the other ones.

Assume I'm being stupid but could you give me a pointer?

Many thanks

Tom

Replies

  1. Low 4 Oct 2013 12:33

    What's your Form tag and Results tag? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.

  2. Tom Carwardine 4 Oct 2013 12:39

    Sure thing, thanks for the fast reply!

    Form tag: http://pastie.org/8377370

    Results:

    {exp:low_search:results query="{segment_1}" channel="properties" {disable} status="open" orderby="rent" sort="asc"}

    {title} - {bedrooms} - {rent}

    {/exp:low_search:results}

    The results is mega simplified for debugging, it was outputting into some Stash values/lists.

  3. Low 4 Oct 2013 12:46

    Your select tag looks like this:

    <select name="bedrooms">


    This translates to a parameter that looks like this:

    bedrooms="value"


    ...which obviously isn't a valid parameter. However, this is:

    search:bedrooms="value"


    ...which translates to this select tag:

    <select name="search:bedrooms">


    The variable you can use is {low_search_search:bedrooms}. Note that the default behaviour is a substring search for this, so searching for 1 will also return 10. To make sure the search is exact, you can use this parameter in the Form tag:

    exact="search:bedrooms"


    As seen in the docs.

  4. Tom Carwardine 4 Oct 2013 12:51

    Thanks Low, feel stupid now.

    I think I was mislead due to the range and relationship not needing 'search:' in front of them (I guess because they not native, but part of Low Search).

    How would I check against search:bedrooms to test for selected with the select options. I was using {low_search_bedrooms} but this is now empty. What would you recommend?

    Thanks again

    Tom

  5. Low 4 Oct 2013 12:52

    The variable you can use is {low_search_search:bedrooms}.

  6. Tom Carwardine 4 Oct 2013 12:54

    Sorry, found it. I'll shut up now. ;-)