Setting Basic search as a default search

We enabled the Advanced Search (btw: we stick to Solr since we have issue with what is returned with elasticsearch), and it is of course pretty useful (since we realized the basic search is done only on names).

Is it possible to set the Basic Search as a default, instead of the Advanced Search?

**Version 7.11.18**
PHP 7.3.27
Centos 7 (updated)

Hey!

Just to double check, this is the Global Search you’re talking about, right?


I’m not aware of a way to make “Basic” search the default in the CRM, while retaining Advanced Search
I don’t think it’s something that’s available OOTB currently, unless I’m mistaken?
(if someone knows of way, that’d be good to know!)

You can sort-of make Basic Search the default by disabling AOD
(Admin->AOD Settings)
But I think this just removes the ability to use Advanced Search


You might need to do some custom work if you want to retain Advanced Search, but have Basic Search be the default

It looks like the Search format used might be decided in the file:
modules/Home/UnifiedSearch.php

It seems to check for various values, such as Lucene Search/AOD being enabled, then it decides what kind of Search format to use from there

So I would recommend starting with this functionality, if you are looking to customise it

Yes, I confirm I have the following:

$sugar_config['aod']['enable_aod'] = true;
$sugar_config['search']['controller'] = 'UnifiedSearch';
$sugar_config['search']['defaultEngine'] = 'BasicAndAodEngine';
$sugar_config['search']['ElasticSearch']['enabled'] = false;

then the default is the advanced, where I see " Use Basic Search" to go to the Basic Search (which has parameter “search_fallback=1” in the url.

I solved by changing themes/SuiteP/tpls/_headerModuleList.tpl adding

<input type="hidden" class="form-control" name="search_fallback" value="1">

to the form

<form id="searchformdropdown" class="searchformdropdown" name='UnifiedSearch' action='index.php'

that line has to be repeated, in that file, 3 times since there are 3 kinds of bars: mobile-bar, tablet-bar, desktop-bar

Hey,

Ah great!

Thanks for letting us know!


Just a side note, if you make changes directly in the core files, there is a chance that your changes will be overwritten in an upgrade.

I’d recommend making the changes in the custom directory, to make them upgrade safe


In this case, you should just be able to copy the file to:
custom/themes/SuiteP/tpls/_headerModuleList.tpl

And make the same changes here.
After a Quick Repair and Rebuild, the changes should take effect

1 Like

wow, thank you so much!

I just did it, and it works perfectly!

So, to summarize, the solution is to customize the theme:

create a directory to keep this customization safe from future upgrades:

mkdir -p custom/themes/SuiteP/tpls/

Customize ./themes/SuiteP/tpls/_headerModuleList.tpl by copying into the customization directory:

cp ./themes/SuiteP/tpls/_headerModuleList.tpl custom/themes/SuiteP/tpls/

Edit custom/themes/SuiteP/tpls/_headerModuleList.tpl by adding

<input type="hidden" class="form-control" name="search_fallback" value="1">

to the form

<form id="searchformdropdown" class="searchformdropdown" name='UnifiedSearch' action='index.php'

that line has to be repeated, in that file, 3 times since there are 3 kinds of bars: mobile-bar, tablet-bar, desktop-bar.

then do a Quick Repair and Rebuild

(thanks John!)

2 Likes

Hi, me again

The cited solution did work on 7.11.18 but stopped working on 7.11.23

did anybody find a workaround?

Yes, the customization is still working, just repeat the above added line 6 times, instead of 3