Remove 'Do' config key and check for configured URLs for each operation as necessary.
@@ -273,7 +273,7 @@ func runServ(c *cli.Context) error {
cmd = []string{verb, repoFullName}
}
runGit(cmd, requestMode, user, owner, repo)
- if setting.Search.Do && (requestMode == models.ACCESS_MODE_WRITE) {
+ if setting.Search.IndexURL != "" && (requestMode == models.ACCESS_MODE_WRITE) {
models.StartIndexing(user, owner, repo)
return nil
@@ -16,7 +16,7 @@ import (
// StartIndexing sends an indexing request to the configured indexing service
// for a repository.
func StartIndexing(user, owner *User, repo *Repository) {
- if !setting.Search.Do {
+ if setting.Search.IndexURL == "" {
log.Trace("Indexing not enabled")
return
@@ -194,7 +194,7 @@ func (repo *Repository) UpdateRepoFile(doer *User, opts UpdateRepoFileOptions) (
return fmt.Errorf("git push origin %s: %v", opts.NewBranch, err)
- if setting.Search.Do {
+ if setting.Search.IndexURL != "" {
StartIndexing(doer, repo.MustOwner(), repo)
@@ -331,7 +331,6 @@ var (
HasRobotsTxt bool
Search struct {
- Do bool
IndexURL string `ini:"INDEX_URL"`
SearchURL string `ini:"SEARCH_URL"`
@@ -16,7 +16,7 @@ func Search(c *context.APIContext) {
c.Status(http.StatusUnauthorized)
+ if setting.Search.SearchURL == "" {
c.Status(http.StatusNotImplemented)
@@ -12,7 +12,7 @@ import (
)
func Suggest(c *context.APIContext) {
@@ -20,7 +20,7 @@ const (
func Search(c *context.Context, keywords string, sType int64) ([]byte, error) {
return nil, fmt.Errorf("Extended search not implemented")