diff options
| author | Filip Mikina <fm394471@students.mimuw.edu.pl> | 2025-08-20 07:35:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-20 07:35:31 +0200 |
| commit | 6b57705e50875d9348c855700994395ce8a55b43 (patch) | |
| tree | fd47dfeb6df94cc8efb92de068d9a925699ae177 /searx/settings.yml | |
| parent | 25647c20d1904840d089892bb118390f46c66984 (diff) | |
[feat] engines: add GitHub Code Search engine (#5074)
This patch adds GitHub Code Search [1] engine to allow querying the codebases.
Template code.html is changed to allow passthrough of strip and highlighting
options.
Engine Searchcode is adjusted to pass filename and not rely on hardcoded
extensions.
GitHub search code API does not return the exact code line indices, this
implementation assigns the code arbitrary numbers starting from 1
(effectively relabeling the code).
The API allows for unauth calls, and the default engine settings default to
that, although the calls are heavily rate limited.
The 'text' lexer is the default pygments lexer when parsing fails.
[1] https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-code
Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
Diffstat (limited to 'searx/settings.yml')
| -rw-r--r-- | searx/settings.yml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/settings.yml b/searx/settings.yml index d21192651..0cd293d7e 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -983,6 +983,24 @@ engines: engine: github shortcut: gh + - name: github code + engine: github_code + shortcut: ghc + disabled: true + ghc_auth: + # type is one of: + # * none + # * personal_access_token + # * bearer + # When none is passed, the token is not requried. + type: "none" + token: "token" + # specify whether to highlight the matching lines to the query + ghc_highlight_matching_lines: true + ghc_strip_new_lines: true + ghc_strip_whitespace: false + timeout: 10.0 + - name: codeberg # https://docs.searxng.org/dev/engines/online/gitea.html engine: gitea |