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

Support archive

Problem filtering by native relationship where record are NOT related

Federico 3 May 2017 14:50 problem, pending

Hi,

probably I found a bug in your extension "Low Search" , what I'm trying to do is to get all record that are NOT related (native multiple relationships) with a specific record, the problem is exactly with the "not" operator that seems to be corrupted for the relations search, in fact it returns no results instead of returning the proper records list, the same expression works fine without the "not" operator and returns the expected results.
The expression in question is the following:

{exp:low_search:results child:my_related_fieldname="not MY_ENTRY_ID" limit="10"}

. . . . .

{/exp:low_search:results}

Please help me to find a solution!

P.S.: in the profiler, the only query regarding your extension is the following:

SELECT 'parent_id' AS entry_id
FROM ('exp_relationships')
WHERE 'child_id' NOT IN ('12657')
AND 'field_id' = '102'

Thanks,
Federico.

Replies

  1. Federico 3 May 2017 15:18

    I done a better debug and found that the bug is that the extension is not retrieving records that has no relations at all, so it retrieve records that are related with any other record but not record with the relationship field empty.

    It should consider records with no relations as records NOT RELATED with the target entry.

    Hope this will be useful, I'm looking forward to your reply!

    Thanks,
    Federico.

  2. Low 3 May 2017 15:47

    I see what you mean, but this issue might actually be much trickier to solve than you might think. I'll have to do some research and I'll get back to you.

  3. Federico 4 May 2017 07:04

    Hi,

    thanks for your reply, I'll wait your solution here, please give priority to this bug as we need the solution to finalize our project!

    Thanks,
    Federico.

  4. Low 5 May 2017 16:10

    Okay, as I thought, this one is tricky, mainly because of the way LS' filters work consecutively, passing on matching IDs from one filter to the next.

    First of all, it would mean a possible performance hit, especially if there are lots of entries that would match the exclusion (lots of channels, lots of entries).

    Secondly, it would work just like the native Categories would: if an entry has multiple children and you would only want to exclude a single child, the entry will still be returned. Only if the ID you're excluding is the only related entry, then the result will be filtered.

    If you're OK with the above, then I can see if I can add that to the Relationships filter.