Attached is a patch which adds support for Drupal's built-in search module. This is useful when building a generic search exposed filter for views, or just for folks who want to use core search for contacts.

CommentFileSizeAuthor
#1 crm_core_entity_search_support-1375278-1.patch8.68 KBAnonymous (not verified)
crm_core_contact_search_support.patch4.31 KBAnonymous (not verified)

Comments

Anonymous’s picture

Title: Add drupal core search support for contacts » Add drupal core search support for CRM entities
StatusFileSize
new8.68 KB

Added search support for activities as well.

dealancer’s picture

Version: » 7.x-1.x-dev

@kevee, thanks for a great patch! I appreciate your help. Looks like it is working very nice for contacts! Here is my review:

  • When enabling search for a CRM Core Activity following exception is thrown:
    ( ! ) Fatal error: Call to undefined function crm_core_activity_view() in /var/www/crm/dev3/profiles/drupalcrmdev/modules/crmdev/crm/modules/crm_core_activity/crm_core_activity.module on line 207
    

    This is because crm_core_activity_view() is declared in crm_core_activity_ui. I think, that it is a design flaw and we need to move crm_core_activity_view() to crm_core_activity module.

  • We would like to alter fields to hide their labels, when search indexing is performed, like it is done in node module, see http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/no.... Otherwise when performing a search for Surname we will have all Individual contact types.
  • Here is some empty spaces at the end of lines at the patch, but it is a minor thing.

P.S.
In a future work on a search we could also add some conditions (e.g. entity type, etc).

dealancer’s picture

Status: Needs review » Needs work

Yeah, it needs work now.

dealancer’s picture

I am working on this patch.

After I have moved crm_core_activity_view() into crm_core_activity module, i've fund that activity search is not working, because of the drupal bug: #1425622: Increase length of 'type' field in search_dataset, search_index tables from 16 to 64.

After I have fixed drupal search bug, activity was still not working cause of the call to the crm_core_activity_type_get_name() which does not exist yet, we need to use crm_core_activity_type_name() instaead.

dealancer’s picture

Status: Needs work » Fixed

This patch was updated and committed, code will appear soon in the public repo.

However we need to reprove search abilities, which requires crm_core changes. What can be improved:

- ability to search in the entity tiles
- disable theme before rendering as it is done in node module: http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/modules/no...
- ability to disable field labels from indexing

I am going to create separate issue for that.

Anonymous’s picture

Status: Fixed » Closed (fixed)

As long as the items from #5 are going into a separate issue, this issue is closed.

Anonymous’s picture

Agreed, improvements can also come to the crm_core views per this issue:

#1369618: Fullname filter for views

franz’s picture

Status: Closed (fixed) » Needs work

AFAIK the search integration is actually not complete before those issues are fixed. So I think this issue should remain open to track that down, otherwise people will have a harder time finding out what needs to be done. Do we have links for them already?

dealancer’s picture

Status: Needs work » Postponed

Yeah, this issue depends on #1425622: Increase length of 'type' field in search_dataset, search_index tables from 16 to 64. I am updating status of this issue, cause there is nothing to do yet.

Anonymous’s picture

Status: Postponed » Closed (fixed)

This appears to work now.

  • Commit 61aa9d7 on 7.x-1.x, development, import by dealancer:
    Issue #1375278 by kevee: Add drupal core search support for CRM entities
    
  • Commit d6a07bb on 7.x-1.x, development, import by dealancer:
    Issue #1375278 by keeve, dealancer: moved crm_core_activity_view...

  • Commit 61aa9d7 on 7.x-1.x, development, import, activity_pages by dealancer:
    Issue #1375278 by kevee: Add drupal core search support for CRM entities
    
  • Commit d6a07bb on 7.x-1.x, development, import, activity_pages by dealancer:
    Issue #1375278 by keeve, dealancer: moved crm_core_activity_view...