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

Support archive

Relationship filter set-up

Tim Print 16 Nov 2015 10:56 question, complete

EE 2.9.2
Low Search 3.3.0

Channel & Field set-up

Channel: audition_dates

Channel: applications-ba-hons-musical-theatre
Custom field: cf_appli_date_final_ba_mt (Relationship field to audition_dates)

Eventually I want to set up a saved search for entries with no related entry but for now I am just trying to understand how the relationship filters work.

The following is returning the contents of the low_search_no_results tag but there are definitely entries in the "applications-ba-hons-musical-theatre" related to entry_id 3870 in "auditon_dates".

{exp:low_search:results
channel='applications-ba-hons-musical-theatre'
disable='categories|category_fields'
status='Complete'
limit='25'
paginate='inline'
parent:cf_appli_date_final_ba_mt='3870'}


Am I using the parent filter correctly?
Both these channels use custom statuses and the audition_dates entries have entry dates in the future. Could either of those be an issue?

Replies

  1. Low 16 Nov 2015 13:43

    By saying parent:cf_appli_date_final_ba_mt='3870', you're targeting entries that have entry #3870 as a *parent* through the cf_appli_date_final_ba_mt field.

    Since the parent entry is the entry that has the field, and the child entries are the entries that are selected in that field, your current setup will always return no_results.

    Try child:cf_appli_date_final_ba_mt='3870', which means you're targeting entries that have entry #3870 as a *child* -- which is the case here.

  2. Tim Print 17 Nov 2015 00:03

    The child: filter is working. Thanks!

    I have run into another issue with the way I have this set-up though.

    The "applications-ba-hons-musical-theatre" channel actually has four relationship fields related to the "audition_dates" channel.

    cf_appli_date_1_ba_mt
    cf_appli_date_2_ba_mt
    cf_appli_date_3_ba_mt
    cf_appli_date_final_ba_mt

    The first three are populated by students applying for auditions via a channel entry form in the "applications-ba-hons-musical-theatre" channel. They specify their 1st, 2nd and 3rd choice audition dates.

    "cf_appli_date_final_ba_mt" is then filled in by site admins, notifications are triggered, audition lists are generated etc. etc.

    The issue I am having is that the relationship filter "child:cf_appli_date_final_ba_mt='3870'" in exp:low_search:results is returning entries related to #3870 via any of the four fields not just "cf_appli_date_final_ba_mt".

    I know it is a slightly odd set-up but is that what you would expect to see? Is there anything I can do to only return entries related via "cf_appli_date_final_ba_mt"?

    Thanks again.

  3. Low 17 Nov 2015 10:15

    You're right, it should take that into account. Looks like that's a left-over from pre-EE2.6 compatibility.

    Please update to the latest version and then email me for a patch on the Relationships filter.

  4. Tim Print 17 Nov 2015 13:07

    I've just updated to the latest Low Search (4.4.1) and the filters are working as expected and showing the correct number of entries (only the ones related via cf_appli_date_final_ba_mt).

    One last question.
    I see from this entry https://getsatisfaction.com/low/topic... that IS_EMPTY doesn't work for relationship filters. Is a dummy default entry the best option to simulate this or is there any other way?

    Thanks again for your help.

  5. Low 17 Nov 2015 13:17

    Yeah, a dummy default entry would be best here.

  6. Tim Print 17 Nov 2015 13:29

    Thanks.