mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
feat: wiki search using git-grep
+ add release note
This commit is contained in:
parent
d6915f4d5f
commit
ec4f5495ba
10 changed files with 107 additions and 0 deletions
|
@ -407,3 +407,19 @@ func DeleteWiki(ctx context.Context, repo *repo_model.Repository) error {
|
|||
system_model.RemoveAllWithNotice(ctx, "Delete repository wiki", repo.WikiPath())
|
||||
return nil
|
||||
}
|
||||
|
||||
func SearchWikiContents(ctx context.Context, repo *repo_model.Repository, keyword string) ([]*git.GrepResult, error) {
|
||||
gitRepo, err := git.OpenRepository(ctx, repo.WikiPath())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer gitRepo.Close()
|
||||
|
||||
return git.GrepSearch(ctx, gitRepo, keyword, git.GrepOptions{
|
||||
ContextLineNumber: 0,
|
||||
IsFuzzy: true,
|
||||
RefName: repo.GetWikiBranchName(),
|
||||
MaxResultLimit: 10,
|
||||
MatchesPerFile: 3,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue