I followed the steps on skvare to index CiviCRM contacts via Search API, then to have Views list the contacts with the search box as an exposed filter.

I need to expose a filter that filters results based on what membership type the contact has. That might require a relationship, which is currently not an option in Views for me, so I might have to write a custom relationship handler as well as the custom filter handler. I have been trying to find the code to read to use as a guide but I have been unable to figure out whether these handlers are being defined in CiviCRM, Views, Search API, or the Civicrm Entity module which I'm also using.

How do you define a custom relationship and filter handlers for custom fields on CiviCRM contacts being displayed via Search API, CiviCRM Entity, and Views?

  • I would have thought that a View based on Contacts should be able to give you an exposed Filter of membership types, though of course there is the issue that one contact 'could' have multiple memberships. WHen I check on a 'contact' based view, i do have CiviCRM Member fields available as a Filter Jun 21, 2017 at 0:03
  • This isn't a view of Civicrm contacts, it's a view of indexed Civicrm contacts. I also can add that filter to the former type but the latter type doesn't have it.
    – beth
    Jun 21, 2017 at 22:38

1 Answer 1


If this is about getting Membership fields showing in the ADD RELATED FIELDS selector at the bottom of admin/config/search/search_api/index//fields then I expect this is a civicrm entity issue in which case you could check at this chat channel

Otherwise you may be looking for sites/all/modules/civicrm/drupal/modules/views

  • I suspect that it does have to do with the related fields. Thanks!
    – beth
    Jun 21, 2017 at 22:38
  • I also tried the channel you linked but it doesn't seem to have much activity.
    – beth
    Jun 22, 2017 at 14:29
  • looks to me like you are getting helped there Jun 23, 2017 at 4:21
  • Yeah after I commented, I got some advice. However, I tried the suggestion I was given there and it didn't solve the problem because, as mentioned in this answer, it seems like this is an issue in the way Search API is relating to Civi rather than something that can be fixed in Views.
    – beth
    Jun 27, 2017 at 15:09
  • guess there is a bit more work to do with getting civi working thoroughly with Search API Jun 27, 2017 at 20:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.