Shiny Nematoda and Gusted
cdc27b0d62
feat: add support to opt-in for fuzzy search ( #10378 )
...
The rationale for keeping it behind a flag is due to fuzzy search being computationally intensive #5261
Admins may opt-in by setting the `[indexer].REPO_INDEXER_FUZZY_ENABLED` flag to true.
Closes #10331
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10378
Reviewed-by: Gusted <gusted@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2025-12-17 13:51:48 +01:00
0ko
ab6ea6a743
fix(ui): restore code search types ( #9053 )
...
Fix regression of https://codeberg.org/forgejo/forgejo/pulls/8736
Preview
Before: https://codeberg.org/attachments/d46743e7-beb3-404e-a103-ea8068760171
After: https://codeberg.org/attachments/0d9dcdb7-7b4f-4bbc-8776-67fd364e26a9
Reported-by: Antonin Delpeuch <antonin@delpeuch.eu >
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9053
Reviewed-by: Beowulf <beowulf@beocode.eu >
Reviewed-by: Antonin Delpeuch <wetneb@noreply.codeberg.org >
Reviewed-by: Gusted <gusted@noreply.codeberg.org >
Reviewed-by: Ellen Εμιλία Άννα Zscheile <fogti@noreply.codeberg.org >
2025-08-29 18:56:54 +02:00
Gusted and Earl Warren
90f8239448
fix: make test suite run on older git version ( #8188 )
...
Ref: forgejo/forgejo#8140 , forgejo/forgejo#8144
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8188
Reviewed-by: Michael Kriese <michael.kriese@gmx.de >
Co-authored-by: Gusted <postmaster@gusted.xyz >
Co-committed-by: Gusted <postmaster@gusted.xyz >
2025-06-14 19:50:58 +02:00
Gusted and Gusted
2457f5ff22
chore: branding import path ( #7337 )
...
- Massive replacement of changing `code.gitea.io/gitea` to `forgejo.org`.
- Resolves forgejo/discussions#258
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7337
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org >
Reviewed-by: Michael Kriese <michael.kriese@gmx.de >
Reviewed-by: Beowulf <beowulf@beocode.eu >
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net >
Co-authored-by: Gusted <postmaster@gusted.xyz >
Co-committed-by: Gusted <postmaster@gusted.xyz >
2025-03-27 19:40:14 +00:00
Shiny Nematoda and Gusted
3816db68aa
feat(code search): replace fuzzy search with union search for indexer ( #6947 )
...
Fuzzy searching for code has been known to be problematic #5264 and in my personal opinion isn't very useful.
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6947
Reviewed-by: Gusted <gusted@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2025-03-11 21:22:51 +00:00
Robert Wolff and Earl Warren
dc5bc1fe5b
linting: fix typos, add toml validation ( #7007 )
...
- adds the `toml` plugin to the `eslint` linting → expect to have `options/setting/config.toml` by #6862
- fixes `make lint-codespell` commands
- related concerning `codespell`: #3270
- info: codespell check is and was not activated in the workflows (could maybe, runs only few seconds on my system)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7007
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org >
Co-authored-by: Robert Wolff <mahlzahn@posteo.de >
Co-committed-by: Robert Wolff <mahlzahn@posteo.de >
2025-02-21 08:23:03 +00:00
Shiny Nematoda and 0ko
ee214cb886
feat: filepath filter for code search ( #6143 )
...
Added support for searching content in a specific directory or file.
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6143
Reviewed-by: Gusted <gusted@noreply.codeberg.org >
Reviewed-by: 0ko <0ko@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2024-12-22 12:24:29 +00:00
Shiny Nematoda
f2ab4ff83a
fix(grep): fix git-grep for code search when git version is below 2.38
2024-10-31 15:24:53 +00:00
Radosław Piliszek
cd62d0f5e8
git-grep: add comments on highlighting support
2024-09-16 16:20:55 +02:00
Shiny Nematoda and Radosław Piliszek
663e957d3d
ui(git-grep): expose regexp mode in dropdown
2024-09-16 16:20:55 +02:00
Radosław Piliszek
6d6116857c
git-grep: support regexp
2024-09-16 16:20:40 +02:00
Earl Warren
0c70e11df8
Merge pull request 'git-grep: refactor defaults' ( #4964 ) from yoctozepto/git-grep-refactor-defaults into forgejo
...
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4964
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org >
2024-08-19 13:12:37 +00:00
Radosław Piliszek
f784260633
git-grep: refactor defaults
...
One method to set them all... or something like that.
The defaults for git-grep options were scattered over the run
function body. This change refactors them into a separate method.
The application of defaults is checked implicitly by existing
tests and linters, and the new approach makes it very easy
to inspect the desired defaults are set.
2024-08-19 14:28:01 +02:00
Earl Warren
fbb2252314
Merge pull request 'git-grep: fix for initial dashes in expressions' ( #4967 ) from yoctozepto/git-grep-fix-words into forgejo
...
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4967
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org >
2024-08-17 07:07:40 +00:00
Otto
d26ad8dbe5
Merge pull request 'git-grep: set timeout to 2s by default and allow configuring it' ( #4966 ) from yoctozepto/git-grep-timeout into forgejo
...
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4966
Reviewed-by: Otto <otto@codeberg.org >
2024-08-15 12:15:16 +00:00
Radosław Piliszek
824dd6bc5d
git-grep: set timeout to 2s by default and allow configuring it
...
We need to shorten the timeout to bound effectively for
computation size. This protects against "too big" repos.
This also protects to some extent against too long lines
if kept to very low values (basically so that grep cannot run out
of memory beforehand).
Docs-PR: forgejo/docs#812
2024-08-14 07:55:05 +02:00
Radosław Piliszek
f4d86b4ab0
git-grep: fix for initial dashes in expressions
...
There is no reason to reject initial dashes in git-grep
expressions... other than the code not supporting it previously.
A new method is introduced to relax the security checks.
2024-08-12 22:12:47 +02:00
Otto
4132b18e59
Merge pull request 'git-grep: ensure bounded default for MatchesPerFile' ( #4928 ) from yoctozepto/forgejo:git-grep-limit-matches-per-file into forgejo
...
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4928
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org >
Reviewed-by: Otto <otto@codeberg.org >
2024-08-12 14:37:43 +00:00
Radosław Piliszek
f4a7bf6d2a
git-grep: skip binary files
...
It is a waste of resources to scan them looking for matches
because they are never returned back - they appear as empty
lines in the current format.
Notably, even if they were returned, it is unlikely that matching
in binary files makes sense when the goal is "code search".
2024-08-11 19:10:23 +02:00
Radosław Piliszek
2fbb51ceb2
git-grep: ensure bounded default for MatchesPerFile
...
Analogously to how it happens for MaxResultLimit.
The default of 20 is inspired by a well-known, commercial code
hosting platform.
Unbounded limits are risky because they expose Forgejo to a class
of DoS attacks where queries are crafted to take advantage of
missing bounds.
2024-08-11 14:59:46 +02:00
Radosław Piliszek
7dd7cc7ebc
git-grep: update comment
...
It was outdated and missing detail.
2024-08-10 16:41:12 +02:00
Shiny Nematoda and Earl Warren
06d2e90fa4
feat: highlighted code search results ( #4749 )
...
closes #4534
<details>
<summary>Screenshots</summary>

</details>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4749
Reviewed-by: 0ko <0ko@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2024-08-06 05:57:25 +00:00
Shiny Nematoda
ec4f5495ba
feat: wiki search using git-grep
...
+ add release note
2024-05-20 13:48:50 +00:00
Shiny Nematoda and Earl Warren
b6ca8abcfd
[FEAT] support searching non default branches/tags when using git-grep ( #3654 )
...
resolves https://codeberg.org/forgejo/forgejo/pulls/3639#issuecomment-1806676 and https://codeberg.org/forgejo/forgejo/pulls/3513#issuecomment-1794990
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3654
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2024-05-14 15:41:03 +00:00
Gusted
668709a33f
[BUG] Handle bigger files in git grep
...
- The parser of `git grep`'s output uses `bufio.Scanner`, which is a good
choice overall, however it does have a limit that's usually not noticed,
it will not read more than `64 * 1024` bytes at once which can be hit in
practical scenarios.
- Use `bufio.Reader` instead which doesn't have this limitation, but is
a bit harder to work with as it's a more lower level primitive.
- Adds unit test.
- Resolves https://codeberg.org/forgejo/forgejo/issues/3149
2024-04-11 13:47:50 +02:00
Shiny Nematoda and Earl Warren
baac15f316
[FEAT] Support Include/Exclude Filters for Grep ( #3058 )
...
fixes `TestRepoSearch` failing occasionally
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3058
Reviewed-by: Gusted <gusted@noreply.codeberg.org >
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com >
2024-04-06 13:25:39 +00:00
Shiny Nematoda
db7e6948a1
replace IfZero with cmp.Or
2024-03-28 11:58:26 +00:00
wxiaoguang and Shiny Nematoda
eb21829800
Fix git grep search limit, add test ( #30071 )
...
Fix #30069
2024-03-28 07:48:35 +00:00
1e7a6483b8
Support repo code search without setting up an indexer ( #29998 )
...
By using git's ability, end users (especially small instance users) do
not need to enable the indexer, they could also benefit from the code
searching feature.
Fix #29996


---------
Co-authored-by: silverwind <me@silverwind.io >
2024-03-28 05:16:51 +00:00