Code Sight Search Examples

The Code Sight search engine is optimized for code and, unlike a typical Internet search engine, only indexes code files so developers don't waste time wading through non-code documents and information. 

Black Duck utilizes proprietary user heuristics to allow more popular code files to work their way to the top. Essentially, the more reuse a code file receives, the more likely it will appear higher in your search results. Code Sight provides various ways to restrict or expand search results by using special operators on your search terms. The following search examples, based on Ohloh Code, summarize various ways to modify your search queries to increase your probability of relevancy.

Note: With the exception of CamelCase, searches are case-insensitive. Searching for "Xml" is the same as searching for "xML" etc.

Search for Phrases

You can search for phrases such as “public event” by enclosing the search term in double quotes.

CamelCase
When using CamelCase, the terms are queried as separate terms. To search as a single term, keep everything lowercase — foreachtag.

Class Definitions
Search for classes whose name contains <search term>.
For example, searching for ‘cdef:parser’ will return files with class names containing ‘parser’.

Method Definitions
Search for methods whose name contains <search term>
For example, searching for ‘mdef:insert’ will return files with method names containing ‘insert’

Interface Definitions
Search for interfaces whose name contains <search term>
For example, searching for ‘idef:configuration’ will return files with interface names containing ‘configuration’.

Compound Definitions
Search for classes named ‘tree’ with a method named ‘insert’
For example, searching for ‘cdef:tree mdef:insert’ will return files with classes named ‘tree’ with a method named ‘insert’

Search Syntax
Note: With the exception of CamelCase, searches are case-insensitive. Searching for ‘Xml’ is the same as searching for ‘XML’ is the same as search for ‘xML’ etc.

Example Searches

  • <search terms> within files and file names.<search terms>sort
  • Classes whose names contain <search terms>cdef:<search terms>cdef:tree
  • Functions whose names contain<search terms>fndef:<search terms>fndef:main
  • Interfaces whose names contain <search terms>idef:<search terms>idef:tree
  • Methods whose names contain <search terms>mdef:<search terms>mdef:compute
  • Structures whose names contain <search terms>sdef:<search terms>sdef:rect
  • Files with exact matches to text between quotes“<search terms>”“lock thread”
  • Compound searchescdef:util mdef:unzip
  • Other operators:
    • ctor: Constructor definitions
    • edef: Enum definitions
    • ctordec: Constructor declarations
    • fdef: Field definitions
    • dtor: Destructor definitions
    • odef: Object definitions
    • dtordec: Destructor declarations
    • tdef: Type definitions
    • fndec: Function declarations
    • udef: Union definitions
    • mdec: Method declarations

Note:  Code Sight does not, at this time, support regular expressions.