1

I have a Low Search form that looks like this:

{exp:low_search:form result_page="search/results"}

<input name="search:title" type="text" value="" placeholder="Title"/>

<select name="search:order-model">
<option value="">Select a model</option> 
{exp:low_options:order-model parse="inward"}
  {options}<option value="{option:value}">{option:value}</option>{/options}
{/exp:low_options:order-model}
</select>

<input class="submit" type="submit" value="Search" />

{/exp:low_search:form}

The customer can search by title, model, or both. Now, for the title field I would like to use 'any' mode (return all entries that contain at list part of keyword) while for order-model field I need exact match (e.g. if user searches for m-200 it should omit km-2001 from seach results)

Is there any way to achieve that. It looks like that is probably possible with filters, but what about search form?

1 Answer 1

2

tl;dr: use exact="search:order-model" on your Results tag.

You're not using the Keywords filter here, but the Field Search filter. Hence, the search_mode parameter is not used; it's only used in conjunction with the Keywords filter. The Field Search filter is basically the native search:field_name parameter on steroids, so you can mimic what you'd normally do with such a parameter.

For example, this: search:order-model="=m-200" would look for exactly the value "m-200" in the target field. This is the same as using search:order-model="m-200" exact="search:order-model", which you can split up with LS into a form field and parameter on the Results tag. You've got the former param as a dropdown in your form, so you should add the latter to the Results tag.

1
  • Thank you, that works just as great as the rest of your stuff! =) Commented Dec 3, 2014 at 14:20

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.