CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Profile search: respect Include Nickname setting; general search
Pages: [1]

Author Topic: Profile search: respect Include Nickname setting; general search  (Read 3945 times)

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Profile search: respect Include Nickname setting; general search
January 29, 2009, 07:43:08 am
Use case: profile search to allow anonymous users to search a public directory of organizations, showing a subset of fields for a subset of the orgs in the Civi db. The orgs have their full name in the Organization Name field; some also have an acronym in the Nickname field. Users are to be able to search by either full name or acronym using a single field on the search form.

The neatest solution would seem to be for the profile search to respect the Include Nickname setting in Global Settings - Miscellaneous, so that a profile search on Organization Name also searches the Nickname field, if Include Nickname is checked. Is this feasible?

More generally, it would be great to have a general content search available in profiles (or in some other form not requiring the user to have access to the full Civi interface). Here are some ideas for how this might work:

  • New profile URL, e.g. "civicrm/profile/general?reset=1&gid=N" provides a search form for that profile with a single search box instead of one per searchable field. The box searches all of the fields that are configured as searchable in that profile.
  • New setting in Profile Settings: Enable General Search. Provides a general search box on the profile search form that searches all searchable fields.

Another approach might be to expose the desired fields from the desired contacts to the UF's (e.g. Drupal's) general search mechanism, thus taking advantage of indexing, stemming etc. Did Civinode allow this sort of thing? I use the past tense as the last version on drupal.org is for Drupal 5, Sep 2007.

Dave J

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Profile search: respect Include Nickname setting; general search
January 29, 2009, 08:19:53 am

You should explore the views2 integration in 2.1/2.2 and see if you can customize that to meet your needs. Might be a quicker/faster/easier approach

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Profile search: respect Include Nickname setting; general search
January 29, 2009, 10:32:27 am
Thanks for the reply, Lobo. I've had a look at the views2 integration and although it looks like a promising alternative direction for Civi/Drupal integration, it seems to fall short at the moment re present use case on several counts:
  • filter by contact name or nick name does not work: rather than a text field it presents a drop-down with Yes / No / Any, which inserts a WHERE clause such as "WHERE civicrm_contact.display_name in ('0')"
  • as with profile searches, views filters relate to a single field.
  • doesn't support custom fields (realise I didn't mention these but the profile also has search/view  custom fields)
So I don't think it helps with this use case.

Getting profile search to respect the Include Nickname setting struck me as a nice solution, so that profile search behaves consistently with Find Contacts. I don't know how much of the search code is shared between profile search and Find Contacts - is this a big job?

Thanks again, Dave J.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Profile search: respect Include Nickname setting; general search
January 29, 2009, 03:59:51 pm

hey dave:

1. extending profile search to include nick name for org name / household name / display name is probably not too hard. If you are interested in working on it, please ping us on IRC and we can get you started. All the search code is at CRM/Contact/BAO/Query.php. The code is shared between profiles and search contacts

2. the 2.2 version of views does have support for custom fields (contributed). The filter by is definitely a bug, so if you are looking at it, a patch would be great :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Profile search: respect Include Nickname setting; general search
January 30, 2009, 07:48:44 am
I had a look at the code in CRM/Contact/BAO/Query.php relating to includeNickNameInName and noticed that it occurs in function sortName. I tried using the sort_name field in the profile instead of organization_name and ta-da, it works: if Include Nickname is set, both organization_name and nick_name are searched.  :)

Dave J

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Profile search: respect Include Nickname setting; general search
January 30, 2009, 09:44:49 am
Dave - thx for checking this out. I've added info to the Profile FAQs in the new (2.2) doc:

http://wiki.civicrm.org/confluence/display/CRMUPCOMING/Profiles+FAQ%27s%2C+How+Do+I....

Going forward, please "feel free" to add tips like this to the doc as you uncover them. :-)
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Profile search: respect Include Nickname setting; general search

This forum was archived on 2017-11-26.