|
|
@ -299,6 +299,9 @@ func ExploreCode(ctx *context.Context) { |
|
|
|
page = 1 |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryType := strings.TrimSpace(ctx.Query("t")) |
|
|
|
|
|
|
|
isMatch := queryType == "match" |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
repoIDs []int64 |
|
|
|
repoIDs []int64 |
|
|
|
err error |
|
|
|
err error |
|
|
@ -342,14 +345,14 @@ func ExploreCode(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["RepoMaps"] = rightRepoMap |
|
|
|
ctx.Data["RepoMaps"] = rightRepoMap |
|
|
|
|
|
|
|
|
|
|
|
total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(repoIDs, language, keyword, page, setting.UI.RepoSearchPagingNum) |
|
|
|
total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(repoIDs, language, keyword, page, setting.UI.RepoSearchPagingNum, isMatch) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("SearchResults", err) |
|
|
|
ctx.ServerError("SearchResults", err) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// if non-login user or isAdmin, no need to check UnitTypeCode
|
|
|
|
// if non-login user or isAdmin, no need to check UnitTypeCode
|
|
|
|
} else if (ctx.User == nil && len(repoIDs) > 0) || isAdmin { |
|
|
|
} else if (ctx.User == nil && len(repoIDs) > 0) || isAdmin { |
|
|
|
total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(repoIDs, language, keyword, page, setting.UI.RepoSearchPagingNum) |
|
|
|
total, searchResults, searchResultLanguages, err = code_indexer.PerformSearch(repoIDs, language, keyword, page, setting.UI.RepoSearchPagingNum, isMatch) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("SearchResults", err) |
|
|
|
ctx.ServerError("SearchResults", err) |
|
|
|
return |
|
|
|
return |
|
|
@ -380,6 +383,7 @@ func ExploreCode(ctx *context.Context) { |
|
|
|
|
|
|
|
|
|
|
|
ctx.Data["Keyword"] = keyword |
|
|
|
ctx.Data["Keyword"] = keyword |
|
|
|
ctx.Data["Language"] = language |
|
|
|
ctx.Data["Language"] = language |
|
|
|
|
|
|
|
ctx.Data["queryType"] = queryType |
|
|
|
ctx.Data["SearchResults"] = searchResults |
|
|
|
ctx.Data["SearchResults"] = searchResults |
|
|
|
ctx.Data["SearchResultLanguages"] = searchResultLanguages |
|
|
|
ctx.Data["SearchResultLanguages"] = searchResultLanguages |
|
|
|
ctx.Data["RequireHighlightJS"] = true |
|
|
|
ctx.Data["RequireHighlightJS"] = true |
|
|
|