2

I'm looking for a solution to extend Drupal Core Search functionality to fetch results from Civicrm Events.

Did anyone tried or achieved this? Is there any module to achieve this? any configurations? or any pointers please?

Does CiviCRM Entity module helps to achieve this?

I want drupal to search CiviCRM events along with entire drupal site when someone search for event related content

Drupal Search For Civicrm Events data

TIA

1

Good Question! I have three different ideas for answers to this questions, but I'll lump them all here.

First off, we've used Search API module with CiviCRM Entity with success a number of times. If you have an option to use Search API, because it is easier to setup search indexes without code. You might check out that module to create a more powerful site search.

2nd option, register your own search index. It will be a coded solution, there is no module I am aware of to do what is necessary.This could get to be a complex answer, so first I'll say you will have to making a custom module, if you aren't comfortable with that, then likely best course is to use Search API..

You must have the code from the "CMS Database Integration" CiviCRM page added to your settings.php , civicrm/admin/setting/uf?reset=1

See the Drupal API documentation for hook_search_info()

You'll need to implement that hook to register a search page for the CiviCRM Event entity type...see in the description of the hook_search_info() documentation, at a minimum hook_search_execute() and hook_update_index() . They given a pretty good example of how nodes are integrated into Drupal Core search, and the same methodology can be applied for CiviCRM Events or other entity types. The CiviCRM Entity module would be a requirement to use the same methodology.

3rd option. If you have event related content types, you could add a entity reference field that reference the CiviCRM Events. In that case you might only need some little bit of code, that could modify the search for those event related nodes, to index the referenced event data along with the node that references the event. See hook_node_update_index() . In the example provided, they are adding some information about a node's comments to the node's indexed text...a similar procedure could be used to add data from the referenced event. CiviCRM Entity would again be required, as this is how you can reference CiviCRM events from node types..

Let's start there and see where it goes. Sounds like a fun project!

  • Thank you very much @jackrabbithanna for your detailed explanation. I'll try and see which one works for me. – Developer Sep 11 '18 at 10:37

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.