3

I'm trying to put together a search form with Low Search a few 1 to 1 form inputs with the idea of being able to search by Last Name, State, etc etc...

For some reason though, Low Search appears to ignore all form inputs and returns all results. Here's the form example:

{exp:low_search:form 
    collection="member_profiles" 
    search_mode="exact" 
    result_page="search/members_results" 
    form_class="form"
    exact="last_name|city|state"
    min_score="1"
    require_all="search:last_name|search:city"
}

<fieldset>
    <div class="row">
        <input type="text" name="search:last_name" id="last_name" placeholder="Smith" value="" />
        <input type="text" name="search:city" id="city" placeholder="City" value="" />
    </div>
    <div class="row">
        {exp:reegion_select:states name="search:state"}
        <span class="name">
            <input type="text" placeholder="Zip Code" name="search:postalcode" id="postalcode" class="code" />
        </span>
        <input type="submit" value="search" class="btn">
    </div>
</fieldset>
{/exp:low_search:form}

Now, when I check the Search Logs I do get confirmation that the search has no keywords recorded though I had thought that's what the search: inputs would do.

For extra info, here's the results tag set I'm using (using _GET param passing):

{exp:low_search:results query="" status="not closed" limit="10" disable="member_data"}

But, as mentioned, that just loops over all the entries regardless of filter.

Anyone have any ideas?

1
  • Just out of curiosity do you get the same results with the "Encode query" set to Yes in the Extension settings? (Encoded query instead of GET variables)
    – Natetronn
    Commented Oct 26, 2013 at 5:20

2 Answers 2

2

Stephen is right. The search_mode parameter only applies to keyword searches, so you can safely remove it. The same goes for the min_score parameter. And since the two input fields are single values, you can remove the require_all parameter as well, as that only applies to multiple values.

And since you're using GET variables instead of the encoded query, you can remove the query parameter in the Results tag (that's only used to pass through an encoded query from the URI).

Finally, make sure the search:field_name match the fields exactly. And when in doubt, turn on template debugging and see what Low Search logs.

1

Since you're defining the exact= parameter, I don't believe you need the search_mode="exact" parameter. search_mode="exact" is for name="keywords" searches. Not sure if that would kill your results, but maybe.

From the Low Search docs:

If you’re using multiple search:custom_field selections in your form and you need the matching to be exact, add the field name to the exact parameter. Note, for exact keyword matching, use the search_mode parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.