2

I have a low search form

{exp:low_search:form collection="test" secure="no" search_mode="any" result_page="results/page"}
    <input type="text" name="keyword" />
    <select name="search:my_field" id="my_field">
        <option></option>
        <option value="foo">foo</option>
        <option value="foo bar">foo bar</option>
    </select>
    <button type="submit">Search</button>
{/exp:low_search:form}

I have two entries in the test channel. One of them has the my_field value "foo" and the other one has "foo bar".

When I choose "foo", I get both entries. When I choose "foo bar", I get one entry(the one whose my_field value is "foo bar").

It seems to me that this is caused by the param search_mode="any".

Is there any way to make my_field use exact text search while still retaining full text search for the rest of the form?

1

You're getting keyword searches and the search:my_field parameter mixed up. The search_mode parameter only applies to keywords. The keywords are used to search the index using full text (if applicable).

The search:my_field input fields you're using is identical to setting the channel:entries parameter and will filter results as described in the EE docs. This is native filtering and therefore doesn't use full text. You can use the exact matching syntax in your <select> by prefixing the values with a =.

<select name="search:my_field" id="my_field">
    <option></option>
    <option value="=foo">foo</option>
    <option value="=foo bar">foo bar</option>
</select>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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