Global search returning all records

I’ve been working against the issues with including custom modules in global searches, which are well-documented. I’ve made some progress, but now when I use the “standard SugarCRM search,” it returns ALL of the records for some (but not all) modules, rather than only returning records that match the search.

I ran a search with one working module and one non-working module, and I think I found the problem in the log. This is a log entry for a module that IS working (subj_subjects):

 LEFT JOIN  cos_companies jt0 ON jt0.id=jtl0.cos_companies_subj_subjects_1cos_companies_ida AND jt0.deleted=0
 AND jt0.deleted=0 where (((subj_subjects.name like '%test%'))) AND subj_subjects.deleted=0 ORDER BY subj_subjects.date_entered DESC Start: 0 count: 11

and this is a module that IS NOT working (ents_related_entities):

 LEFT JOIN  cos_companies jt0 ON jt0.id=jtl0.cos_companies_ents_related_entities_1cos_companies_ida AND jt0.deleted=0
 AND jt0.deleted=0 where ents_related_entities.deleted=0 ORDER BY ents_related_entities.date_entered DESC Start: 0 count: 11

It seems the search string, “(((subj_subjects.name like ‘%test%’))),” is not getting included in the non-working modules, so it’s just returning all results that aren’t deleted.

Does anyone know where/how these search parameters are constructed? Is it something I could fix in the PHP?

Thanks!

Can you verify that the module has the unified search to true.
http://developer.sugarcrm.com/2010/09/23/adding-custom-modules-to-global-search/

1 Like

That was indeed the problem . . . or part of it, anyway. I eventually figured out that adding custom fields to global search and having them consistently work is a three-step process - or four if you want to add relate fields.

1 Like