0

I am working on a client site and they have a search form which we are using Low Search for. Two current search fields for keywords and topics (a Playa field) work fine.

I am working on the third field where we need to filter by the position (text input) field of a related employee (Playa field).

Here is the code I currently have:

<select id="position" name="child:news_related_employees[]">
    <option value="">All</option>
    {exp:query sql="SELECT GROUP_CONCAT(entry_id) AS entry_ids, field_id_34 AS p_position FROM exp_channel_data WHERE field_id_34 != '' GROUP BY field_id_34 ORDER BY field_id_34 ASC"}
    <option value="{entry_ids}">{p_position}</option>
    {/exp:query}
</select>

The query works fine, I get a comma separated list of entry_ids per unique position, however the form does not return any results. I assume that's because it is trying to match the entire string of entry_ids to an employee in the Playa field.

Can anyone shed some light on this or know of a way to do what we need? Thanks.

1

Low Search expects a pipe | as a value separator. You can define that in the GROUP_CONCAT clause of your query. So try this:

GROUP_CONCAT(entry_id SEPARATOR '|') AS entry_ids
0

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.