Files
docs/docs/administration/repo-indexer.md
T
silverwind 757fb1927a Document code search and its query syntax (#615)
Documents https://github.com/go-gitea/gitea/pull/39403: a new user page for code search with the query syntax, results and API endpoints, and an update to the repository indexer page saying that `git grep` search needs Git with PCRE.

_Written by Claude._

Reviewed-on: https://gitea.com/gitea/docs/pulls/615
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: silverwind <[email protected]>
2026-11-13 18:45:17 +00:00

2.8 KiB

date, slug, sidebar_position, aliases
date slug sidebar_position aliases
2019-09-06T01:35:00-03:00 repo-indexer 45
/en-us/repo-indexer

Repository indexer

Builtin repository code search without indexer

Users can search the code of a single repository without setting up a repository indexer. This search uses git grep, which is fast for small repositories and requires Git built with PCRE support, as most distributions provide. Searching across repositories requires the repository indexer. See Code Search for the query syntax.

Setting up the repository indexer

Gitea can search through the files of the repositories by enabling this function in your app.ini:

[indexer]
; ...
REPO_INDEXER_ENABLED = true
REPO_INDEXER_PATH = indexers/repos.bleve
MAX_FILE_SIZE = 1048576
REPO_INDEXER_INCLUDE =
REPO_INDEXER_EXCLUDE = resources/bin/**

Please bear in mind that indexing the contents can consume a lot of system resources, especially when the index is created for the first time or globally updated (e.g. after upgrading Gitea).

Choosing the files for indexing by size

The MAX_FILE_SIZE option will make the indexer skip all files larger than the specified value in bytes.

Choosing the files for indexing by path

Gitea applies glob pattern matching from the gobwas/glob library to choose which files will be included in the index.

Limiting the list of files prevents the indexes from becoming polluted with derived or irrelevant files (e.g. lss, sym, map, etc.), so the search results are more relevant. It can also help reduce the index size.

REPO_INDEXER_EXCLUDE_VENDORED (default: true) excludes vendored files from index.

REPO_INDEXER_INCLUDE (default: empty) is a comma separated list of glob patterns to include in the index. An empty list means "include all files". REPO_INDEXER_EXCLUDE (default: empty) is a comma separated list of glob patterns to exclude from the index. Files that match this list will not be indexed. REPO_INDEXER_EXCLUDE takes precedence over REPO_INDEXER_INCLUDE.

Pattern matching works as follows:

  • To match all files with a .txt extension no matter what directory, use **.txt.
  • To match all files with a .txt extension only at the root level of the repository, use *.txt.
  • To match all files inside resources/bin and below, use resources/bin/**.
  • To match all files immediately inside resources/bin, use resources/bin/*.
  • To match all files named Makefile, use **Makefile.
  • Matching a directory has no effect; the pattern resources/bin will not include/exclude files inside that directory; resources/bin/** will.
  • All files and patterns are normalized to lower case, so **Makefile, **makefile and **MAKEFILE are equivalent.