Results 1 to 3 of 3

Thread: Global search does not search full names

  1. #1
    Proware's Avatar
    Proware is offline A Prolific Poster
    Join Date
    Mar 2006
    Location
    Sydney Australia
    Posts
    310

    Default Global search does not search full names

    In the Global Search, if I type in SMITH then I get all smiths including John Smith.

    If I type in John Smith then I get no matches.

    This does not sound correct. It is especially annoying in the Outlook link as it seems to uses the Global search to look up.

    Any ideas about this?
    Cheers

    David Younger
    TSM - The Service Manager
    http://www.theservicemanager.com


    Operating system type and version: Windows 2003 Server
    » Sugar Suite version 4.5.1e Professional
    » Webserver type and version Microsoft-IIS/6.0
    » PHP version 5.2.6
    » MySQL server version 5.0.51a

  2. #2
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: Global search does not search full names

    We implemented a hack to get around this.

    One limitation is that it does not allow wildcarding the end of the first name. For example, if you were searching for "John Smith", it would find it under "John Sm" and "%ohn Smi" but not "Jo Sm"


    Edit modules/Contacts/Contact.php and look for the search code:


    Code:
                    array_push($where_clauses, "contacts.last_name like '$the_query_string%'");
                    array_push($where_clauses, "contacts.first_name like '$the_query_string%'");
                    array_push($where_clauses, "accounts.name like '$the_query_string%'");
                    array_push($where_clauses, "contacts.assistant like '$the_query_string%'");
                    array_push($where_clauses, "contacts.email1 like '$the_query_string%'");
                    array_push($where_clauses, "contacts.email2 like '$the_query_string%'");
    And change it to add an additional line:

    Code:
                    array_push($where_clauses, "contacts.last_name like '$the_query_string%'");
                    array_push($where_clauses, "contacts.first_name like '$the_query_string%'");
                    array_push($where_clauses, "accounts.name like '$the_query_string%'");
                    array_push($where_clauses, "contacts.assistant like '$the_query_string%'");
                    array_push($where_clauses, "contacts.email1 like '$the_query_string%'");
                    array_push($where_clauses, "contacts.email2 like '$the_query_string%'");
                    array_push($where_clauses, "CONCAT(contacts.first_name,' ',contacts.last_name) like '$the_query_string%'");
    It will make the search a little longer but will achieve what you want.

  3. #3
    Proware's Avatar
    Proware is offline A Prolific Poster
    Join Date
    Mar 2006
    Location
    Sydney Australia
    Posts
    310

    Default Re: Global search does not search full names

    Way too cool - thanx!
    Cheers

    David Younger
    TSM - The Service Manager
    http://www.theservicemanager.com


    Operating system type and version: Windows 2003 Server
    » Sugar Suite version 4.5.1e Professional
    » Webserver type and version Microsoft-IIS/6.0
    » PHP version 5.2.6
    » MySQL server version 5.0.51a

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •