1. A computer-implemented method, comprising: building and storing an index of source code files in one or more memory devices, the index incorporating one or more tags and, for each tag, a name of a respective source code file in which the tag is defined, a path to the respective source code file relative to a root directory, and a representation of an include-tree of the respective source code file, where the include-tree is a sequence of files that are included by or imported by the respective source code file; receiving from a client device a search query and a current context, wherein the current context is a file being edited, the current context is in a directory in a path relative to the root directory, and the current context has an associated include-tree; searching the index and identifying a plurality of source code files that define tags that satisfy the search query, the plurality of source code files including a plurality of source code files that are in the include-tree of the current context and at least one file that is not in the include-tree of the current context; ranking each of the plurality of source code files by applying multiple levels of sorting, including a first level of sorting where all source code files that are in the include-tree of the current context are ranked higher than all source code files that are not in the include-tree of the current context, and a second level of sorting where all source code files in the include-tree of the current context are ranked by the relative directory distance from the current context to each source code file; and communicating the ranking of the plurality of source code files to the client device as a response to the search query.