Enable Custom Field Global Search

Hello all!

I have run into a bit of a wall when adding custom fields to Global Search. I have followed this tutorial:
http://developer.sugarcrm.com/2011/04/29/howto-add-custom-fields-into-the-global-search/

and tried samples from here:
https://suitecrm.com/community/suitecrm-7-0-discussion/562-adding-custom-field-to-global-search

But after a ā€˜Repair & Rebuildā€™ and Editing the record, no search results when attempting to use Global Search, I am not using AOD(it is off, as it is the only 2 schedulers that do not work in my installation).

I made a custom textfield for the Accounts module, and have it displayed via studio. It is filled as an Alphanumeric identifier, and I would love to be able to search by this to find said related Account!

Thank you for all your help!

Bryce

Ok! I managed to get it working about an hour after I posted this! : )

This tutorial does indeed work: DevClub - SugarClub

I was just a dummy, and in the wrong directory! To Reiterate the steps I took:

If you have created the new field in studio already:

You should have a newly created file in /custom/Extension/modules/YOUR_MODULE/Ext/Vardefs/ with the name of your field.

Edit this file from:

<?php
$dictionary['MODULE']['fields']['FIELD_NAME'] ['labelValue'] =['DISPLAY_NAME'];
 ?>

to this:

<?php
$dictionary['MODULE']['fields']['FIELD_NAME'] = array (
    'labelValue' => 'DISPLAY_NAME',
    'unified_search' => 'true',
);
 ?>

Then change to THIS Directory: custom/modules/YOUR_MODULE/metadata/ and edit the SearchFields.php file.

Add this to the array:

 'YOUR_FIELD_NAME' =>
  array (
    'query_type' => 'default',
  ),

Save & Do a Repair & Rebuild from the Admin zone. You may need to ā€˜editā€™/ā€˜saveā€™ the affected records to have them show up in Search!

Cheers,

Bryce

2 Likes

A similar way is working on SuiteCRM 8.1.

1. Changes to custom/modules/YOUR_MODULE/metadata/SearchFields.php
Add this to the array (donā€™t forget the trailling _c of a custom field):

  'custom_field_c' =>
  array (
    'query_type' => 'default',
    'force_unifiedsearch' => true,
  ),

2. Admin Tools / Repair / Quick Repair and Rebuild

I didnā€™t have to change anything in /custom/Extension/modules/YOUR_MODULE/Ext/Vardefs/.

3 Likes

Hi all

In my case, it seems that Unified Search inherited the ā€œList Definitionā€ display. However, the inline edit fields are not editable in there. Anyone knows a way to make them editable in the unified search list?

I donā€™t think youā€™ll be able to achieve that without significant coding work, that view is very different from the others, I believe.

Can confirm this work also in 7.14.x

Since PHP8 users had a error 500 when a user searched a mail with lucene search (I think special char are the cause of the timeout)

Switched back to basic search only including some critical custom field for the user to search was my go-to fix.

Now another question, can ā€œforce_unifiedsearchā€ be on false to force the search engine to not index it ?
Goal is to try to have a faster and more stable search engine.

You shouldnā€™t get a 500 error with Lucene index. Iā€™m on 7.14.x and PHP 8 and no 500 errors on search. You might want to try and re-index, or at least let us know what 500 error youā€™re getting.

Thanks mate for the answer !

Sadly, I have PHP timeout on different php files every time, but my php.ini and config is good. I assume itā€™s the number of data that is causing this ā€¦

Did you set both your php.iniā€™s right?

CLI and web server