diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-25 00:05:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-24 17:05:00 +0100 |
commit | 4734d43e1422da04f9ff79ea0212f7e9472b55a1 (patch) | |
tree | d6ba422cc7b7f942d817a83836da426edd007ec4 /templates/shared/search/code | |
parent | 90a4f9a49eecc4b672df0c29f5034be25244191c (diff) | |
download | gitea-4734d43e1422da04f9ff79ea0212f7e9472b55a1.tar.gz gitea-4734d43e1422da04f9ff79ea0212f7e9472b55a1.zip |
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
![image](https://github.com/go-gitea/gitea/assets/2114189/11b7e458-88a4-480d-b4d7-72ee59406dd1)
![image](https://github.com/go-gitea/gitea/assets/2114189/0fe777d5-c95c-4288-a818-0427680805b6)
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/shared/search/code')
-rw-r--r-- | templates/shared/search/code/search.tmpl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/templates/shared/search/code/search.tmpl b/templates/shared/search/code/search.tmpl index 545ec1ea65..cb873f5a92 100644 --- a/templates/shared/search/code/search.tmpl +++ b/templates/shared/search/code/search.tmpl @@ -7,9 +7,16 @@ <div class="ui error message"> <p>{{ctx.Locale.Tr "search.code_search_unavailable"}}</p> </div> - {{else if .SearchResults}} - {{template "shared/search/code/results" .}} - {{else if .Keyword}} - <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{else}} + {{if not .CodeIndexerEnabled}} + <div class="ui message"> + <p>{{ctx.Locale.Tr "search.code_search_by_git_grep"}}</p> + </div> + {{end}} + {{if .SearchResults}} + {{template "shared/search/code/results" .}} + {{else if .Keyword}} + <div>{{ctx.Locale.Tr "search.no_results"}}</div> + {{end}} {{end}} </div> |