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

Support archive

How to - Search multiple fields?

Paul Cripps 1 Jun 2016 13:01 question, complete

We're running EE2.9.2 and LOW Search 4.4.3

We have two fields, {rd_first_name} and {rd_surname}. We want to allow the user to search for either or both of these fields.

I presume we need to use the "Field Search" to achieve this..?

With the initial test (below by no means finished) the results always return all entries regardless...

I've not got to the stage of searching the surname and firstname yet...

{exp:low_search:form query="{segment_3}" }

Search
{/exp:low_search:form}

{exp:low_search:results
query="{segment_3}"
exact="search:rd_first_name"
channel="results_database"
status="not closed"}

{entry_id} - {rd_first_name} {rd_surname}

{/exp:low_search:results}

So I wanted to clarify, before I go any further:

1) Is it possible to search two fields and or a combination of both?
2) Any thought why the above would not work when searching first name alone?

Replies

  1. Low 1 Jun 2016 13:09

    If you want to search multiple fields by a single input field, try and create a collection where you only add weight to just those fields. Then target the collection in your form.

    I can't quite see the contents of the form you copy/pasted -- You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code to share safely. But using the keywords filter would be your best option here, anyway.

  2. Paul Cripps 1 Jun 2016 14:34

    While keywords would work, we really wanted search inputs for first name and or surname, so that we can be very granular with our search, here's the code:

    http://pastie.org/10860270

  3. Low 1 Jun 2016 14:45

    You should be using the full parameter name, ie name="search:rd_first_name".