@@ -993,20 +993,52 @@ def search_code(self, query, sort=None, order=None, per_page=None,
993993 The query can contain any combination of the following supported
994994 qualifiers:
995995
996- -in Qualifies which fields are searched. With this qualifier you can
997- restrict the search to just the file contents, the file path, or
996+ -``in`` Qualifies which fields are searched. With this qualifier you
997+ can restrict the search to just the file contents, the file path, or
998998 both.
999- - language Searches code based on the language it’s written in.
1000- - fork Specifies that code from forked repositories should be
999+ -`` language`` Searches code based on the language it’s written in.
1000+ -`` fork`` Specifies that code from forked repositories should be
10011001 searched. Repository forks will not be searchable unless the fork
10021002 has more stars than the parent repository.
1003- - size Finds files that match a certain size (in bytes).
1004- - path Specifies the path that the resulting file must be at.
1005- - extension Matches files with a certain extension.
1006- - user or repo Limits searches to a specific user or repository.
1003+ - ``size`` Finds files that match a certain size (in bytes).
1004+ - ``path`` Specifies the path that the resulting file must be at.
1005+ - ``extension`` Matches files with a certain extension.
1006+ - ``user`` or ``repo`` Limits searches to a specific user or
1007+ repository.
10071008
1009+ For more information about these qualifiers, see: http://git.io/-DvAuA
10081010
1011+ :param str query: (required), a valid query as described above, e.g.,
1012+ ``addClass in:file language:js repo:jquery/jquery``
1013+ :param str sort: (optional), how the results should be sorted;
1014+ option(s): ``indexed``; default: best match
1015+ :param str order: (optional), the direction of the sorted results,
1016+ options: ``asc``, ``desc``; default: ``desc``
1017+ :param int per_page: (optional)
1018+ :param bool text_match: (optional), if True, return matching search
1019+ terms. See http://git.io/4ct1eQ for more information
1020+ :param int number: (optional), number of repositories to return.
1021+ Default: -1, returns all available repositories
1022+ :param str etag: (optional), previous ETag header value
1023+ :return: generator of :class:`Repository <github3.repos.Repository>`
10091024 """
1025+ params = {'q' :query }
1026+ headers = {}
1027+
1028+ if sort == 'indexed' :
1029+ params ['sort' ]= sort
1030+
1031+ if sort and order in ('asc' ,'desc' ):
1032+ params ['order' ]= order
1033+
1034+ if text_match :
1035+ headers = {
1036+ 'Accept' :'application/vnd.github.v3.full.text-match+json'
1037+ }
1038+
1039+ url = self ._build_url ('search' ,'code' )
1040+ return SearchIterator (number ,url ,Repository ,self ,params ,etag ,
1041+ headers )
10101042
10111043def search_repositories (self ,query ,sort = None ,order = None ,
10121044per_page = None ,text_match = False ,number = - 1 ,