0

I have a list of nodes (group), each referencing a number of other nodes (event) using an Entity Reference.

I can query the the "group" using $query->fieldCondition('field_group', 'tid', $group_tid);.

However, I want to then "weight" the results based on the A: if they have a matching section. B: how many events match.

So, if I want all groups with the events foo and bar, and the data was

Group 1
   foo
Group 2
    foo
    bar
Group 3
 {no sections}

Then the results would be:

Group 2
Group 1
Group 3

Hopefully that makes some sense. Thanks for any help / advice!

4
  • 1
    i think i get what your asking. is this of any help api.drupal.org/api/drupal/includes!database!select.inc/function/… . Apologies if not !
    – Deejay
    Commented Aug 22, 2014 at 14:23
  • I think that is a great start, but I am not getting how you would use it with an EntityFieldQuery... Commented Aug 22, 2014 at 14:35
  • I think what you are doing is a bit too complex for an EFQ and would require either multiple steps, or a View.
    – beth
    Commented Aug 22, 2014 at 19:03
  • I think you are right about it being too complex. Don't think views would be much help though. Commented Sep 2, 2014 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.