Low Search in fields: combine different search_modes
I have a Low Search form that looks like this:
{exp:low_search:form result_page="search/results"}
Select a model
{exp:low_options:order-model parse="inward"}
{options}{option:value}{/options}
{/exp:low_options:order-model}
{/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?
FYI, I've also submitted same question on SE: http://expressionengine.stackexchange...
Replies
Low 3 Dec 2014 13:56
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.