You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo-indexer.en-us.md 2.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ---
  2. date: "2019-09-06T01:35:00-03:00"
  3. title: "Repository indexer"
  4. slug: "repo-indexer"
  5. weight: 45
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "advanced"
  11. name: "Repository indexer"
  12. weight: 45
  13. identifier: "repo-indexer"
  14. ---
  15. # Repository indexer
  16. ## Setting up the repository indexer
  17. Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/):
  18. ```
  19. [indexer]
  20. ; ...
  21. REPO_INDEXER_ENABLED = true
  22. REPO_INDEXER_PATH = indexers/repos.bleve
  23. UPDATE_BUFFER_LEN = 20
  24. MAX_FILE_SIZE = 1048576
  25. REPO_INDEXER_INCLUDE =
  26. REPO_INDEXER_EXCLUDE = resources/bin/**
  27. ```
  28. 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).
  29. ### Choosing the files for indexing by size
  30. The `MAX_FILE_SIZE` option will make the indexer skip all files larger than the specified value.
  31. ### Choosing the files for indexing by path
  32. Gitea applies glob pattern matching from the [`gobwas/glob` library](https://github.com/gobwas/glob) to choose which files will be included in the index.
  33. 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.
  34. `REPO_INDEXER_EXCLUDE_VENDORED` (default: true) excludes vendored files from index.
  35. `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_".
  36. `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`.
  37. Pattern matching works as follows:
  38. * To match all files with a `.txt` extension no matter what directory, use `**.txt`.
  39. * To match all files with a `.txt` extension _only at the root level of the repository_, use `*.txt`.
  40. * To match all files inside `resources/bin` and below, use `resources/bin/**`.
  41. * To match all files _immediately inside_ `resources/bin`, use `resources/bin/*`.
  42. * To match all files named `Makefile`, use `**Makefile`.
  43. * Matching a directory has no effect; the pattern `resources/bin` will not include/exclude files inside that directory; `resources/bin/**` will.
  44. * All files and patterns are normalized to lower case, so `**Makefile`, `**makefile` and `**MAKEFILE` are equivalent.