Answers.Body: <p>Good Question! I have three different ideas for answers to this questions, but I'll lump them all here. </p>
  
  <p>First off, we've used <a href="https://www.drupal.org/project/search_api" rel="nofollow noreferrer">Search API</a> 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.</p>
  
  <p>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..</p>
  
  <p>You must have the code from the "CMS Database Integration" CiviCRM page added to your settings.php , civicrm/admin/setting/uf?reset=1</p>
  
  <p>See the Drupal API documentation for <a href="https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_info/7.x" rel="nofollow noreferrer">hook_search_info()</a></p>
  
  <p>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 <a href="https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_execute/7.x" rel="nofollow noreferrer">hook_search_execute()</a> and <a href="https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_update_index/7.x" rel="nofollow noreferrer">hook_update_index()</a> . 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.</p>
  
  <p>3rd option. If you have event related content types, you could add a <a href="https://www.drupal.org/project/entityreference" rel="nofollow noreferrer">entity reference field</a> 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 <a href="https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_update_index/7.x" rel="nofollow noreferrer">hook_node_update_index()</a> . 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..</p>
  
  <p>Let's start there and see where it goes. Sounds like a fun project!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-11T10:37:35.477Z
Answers.Text: Thank you very much @jackrabbithanna for your detailed explanation. I'll try and see which one works for me.
Answers.UserDisplayName: Developer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-07T16:51:05.907Z
Answers.LastActivityDate: 2018-09-07T16:51:05.907Z
Answers.UserDisplayName: jackrabbithanna
Body: <p>I'm looking for a solution to extend Drupal Core Search functionality to fetch results from Civicrm Events.</p>
  
  <p>Did anyone tried or achieved this? Is there any module to achieve this? any configurations? or any pointers please?</p>
  
  <p>Does CiviCRM Entity module helps to achieve this?</p>
  
  <p>I want drupal to search CiviCRM events along with entire drupal site when someone search for event related content</p>
  
  <p><a href="https://i.sstatic.net/NsN5J.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NsN5J.png" alt="Drupal Search For Civicrm Events data"></a></p>
  
  <p>TIA</p>
  
Tags: <drupal><civicrm-home><civicrm-entity>
Title: Drupal Core Search to show results from CiviCRM Events data along with drupal content results
ThreadText: # Drupal Core Search to show results from CiviCRM Events data along with drupal content results
  
  (Asked by: username_0 on 2018-09-07)
  
  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](https://i.sstatic.net/NsN5J.png)](https://i.sstatic.net/NsN5J.png)
  
  TIA
  
  **Tags:** drupal, civicrm-home, civicrm-entity
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-07. Score: 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](https://www.drupal.org/project/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()](https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_info/7.x)
  
  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()](https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_search_execute/7.x) and [hook\_update\_index()](https://api.drupal.org/api/drupal/modules%21search%21search.api.php/function/hook_update_index/7.x) . 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](https://www.drupal.org/project/entityreference) 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()](https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_update_index/7.x) . 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!
  
  > **Comments:**
  > **username_0**: Thank you very much @username_1 for your detailed explanation. I'll try and see which one works for me.  
  
  ---
  
  