SugarCRM Code Search Engine

sugarcrmdevelopers —  May 7, 2012

Often times you need to find a specific chunk of code in SugarCRM’s code base.  Traditionally, developers will result to using grep or maybe their IDE to try to track down whatever they are searching on.  However, this process tends to be slow; it can take several minutes for grep to search through all of the code.

Epicom has recently launched a search engine that returns results almost immediately.  Most searches come back in less than 5ms.  You can now quickly run a search across many versions of Sugar simultaneously to track down what you are looking for.  Once you get the result back you can then filter down the results to only a certain version of Sugar or to a particular file type (like php, tpl, css or js).

The initial results page displays both the filename as well as all of the lines that contain your initial search phrase, highlighting the actual search term.

If you click on the filename, you are redirected to the full source code for that page which will highlight both the lines that contain your results as well as the actual phrase.

Not only are you able to quickly search and find all references to a certain function, you can also use the search engine to search trends in the Sugar code base.  Here are some example cases:

  • curious how many references to jquery there are in different versions? (hint – 6.5 has significantly more references than any previous version)
  • how often does Sugar use heredoc? (they’ve been steadily removing heredoc references since Sugar 4.5.1, but they just started using EOT (compared to EOQ from before) on sugar 6.5)
  • how often do they use print_r? (that has slowly been on the rise, but probably growing much slower than the overall codebase)

We hope you find this as a useful tool that will save you time when looking for functions and related code in your SugarCRM code base.