Use space path + repo path for repo IDs to search (#843)

This commit is contained in:
Shubham Agrawal 2023-11-29 18:31:03 +00:00 committed by Harness
parent 5dc8c93233
commit acc7083c59
2 changed files with 7 additions and 6 deletions

View File

@ -44,11 +44,13 @@ func (c *Controller) Search(
return types.SearchResult{}, fmt.Errorf("failed to search repos by path: %w", err) return types.SearchResult{}, fmt.Errorf("failed to search repos by path: %w", err)
} }
if len(repoIDToPathMap) == 0 { spaceRepoIDToPathMap, err := c.getReposBySpacePaths(ctx, session, in.SpacePaths)
repoIDToPathMap, err = c.getReposBySpacePaths(ctx, session, in.SpacePaths)
if err != nil { if err != nil {
return types.SearchResult{}, fmt.Errorf("failed to search repos by space path: %w", err) return types.SearchResult{}, fmt.Errorf("failed to search repos by space path: %w", err)
} }
for repoID, repoPath := range spaceRepoIDToPathMap {
repoIDToPathMap[repoID] = repoPath
} }
if len(repoIDToPathMap) == 0 { if len(repoIDToPathMap) == 0 {

View File

@ -19,7 +19,6 @@ type (
Query string `json:"query"` Query string `json:"query"`
// RepoPaths contains the paths of repositories to search in // RepoPaths contains the paths of repositories to search in
// If both space path and repo path are provided, the repo path will be used
RepoPaths []string `json:"repo_paths"` RepoPaths []string `json:"repo_paths"`
// SpacePaths contains the paths of spaces to search in // SpacePaths contains the paths of spaces to search in