I’m try to find out how the search function , top right on every screen, works
I have a contact John Smith
These are my search queries and their results
Search ‘John’ - > John Smith
Search ‘Joh’ - > Nothing
Search ‘ohn’ - > Nothing
Search ‘Joh%’ - > Nothing
Search ‘%Joh’ - > Nothing
Search ‘%Joh%’ - > Nothing
I don’t understand this, why are my wildcards not working?
config.php -> ‘search_wildcard_char’ => ‘%’,
Are you wrapping your search query in quotes? Adding quotes around the text causes it to be an “Exact Match” search and not a wildcard search.
http://support.sugarcrm.com/Documentation/Sugar_Versions/7.6/Ult/Application_Guide/Search/
No I’m not using quotes. Sorry for the confusion
I have tried and this is my result: wildcards work only in module search while in the global search (at the top bar), wildcards don’t work.
In the top bar if you look for whole words, it works, irrespective of where the word is positioned within any string. If, instead you search for a portion of a word, it will not find it.
I don’t know if there is a way to add a config option to allow for wildcard search also from there
I had the same problem, and the only way I found to solve the problem was changing the default behavior of the search.
If you check modules/Accounts/AccountsFormBase.php on line 59 you have the search criteria:
$query = $baseQuery ." name like '".$_POST[$prefix.'name']."%'";
Basically you are only able to find a word(s) on the beginning of the name.
I change to previous line to:
$query = $baseQuery ." name like '%".$_POST[$prefix.'name']."%'";
The same happens with Contacts, you can change it too on modules/Contacts/ContactFormBase.php on line 75