v1

latestOpenAPI 3.0.1Apache 2.02026-07-13227.1 KB
search

Searches through source code

Performs a search through the full Debian Code Search corpus, blocking until all results are available (might take a few seconds depending on the search query).

Search results are ordered by their ranking (best results come first).

get/search

Query parameters

querystring required

The search query, for example who knows... (literal) or who knows\.\.\. (regular expression). See https://codesearch.debian.net/faq for more details about which keywords are supported. The regular expression flavor is RE2, see https://github.com/google/re2/blob/master/doc/syntax.txt

match_mode'literal' | 'regexp'

Whether the query is to be interpreted as a literal (literal) instead of as an RE2 regular expression (regexp). Literal searches are faster and do not require escaping special characters, regular expression searches are more powerful.

Response

All search results

packagestring required

The Debian source package containing this search result, including the full Debian version number.

pathstring required

Path to the file containing the this search result, starting with package.

lineinteger required

Line number containing the search result.

context_beforestring[]

Up to 2 full lines before the search result (see context).

contextstring required

The full line containing the search result.

context_afterstring[]

Up to 2 full lines after the search result (see context).

Example response

[
  {
    "package": "i3-wm_4.18-1",
    "path": "i3bar/src/xcb.c",
    "line": 1313,
    "context_before": [
      "    } else {",
      "        cursor = xcb_generate_id(xcb_connection);"
    ],
    "context": "        i3Font cursor_font = load_font(\"cursor\", false);",
    "context_after": [
      "        xcb_create_glyph_cursor(",
      "            xcb_connection,"
    ]
  }
]