Open Hub Code provides various ways to restrict or expand search results by using special operators on your search terms, including:
· Search for phrases
You can search for phrases such as “public event” by enclosing the search term in double quotes.
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: Open Hub Code does not, at this time, support regular expressions. That said, we are currently underway with a number of important improvements to both the data and features in Open Hub Code, so we would like to hear from you with some examples of the queries that you submit in the regex realm and what results you’d like to see returned so that we can best provide the related functionality and nice ranking around those results. Please visit the Open Hub forum. Thank you!
Posted in: Open Hub Code