From c9546d4cdd5f7de8f56b7d4a9806d1aca784cf3f Mon Sep 17 00:00:00 2001 From: David Svantesson Date: Sun, 25 Aug 2019 19:06:36 +0200 Subject: Include description in repository search. (#7942) * Add description in repository search. Signed-off-by: David Svantesson * Refactor SearchRepositoryByName with a general function SearchRepository Signed-off-by: David Svantesson * Allow to specify if description shall be included in API repo search. Signed-off-by: David Svantesson * Add new app.ini setting for whether to search within repo description. Signed-off-by: David Svantesson * Search keyword in description (if setting enabled) on: - Explore page - Organization profile page - User profile page - Admin repo page Do not search keyword in description on: - Any non-keyword search (not relevant) - Incremental search (uses API) Signed-off-by: David Svantesson * Put parameters related to keyword directly after it Signed-off-by: David Svantesson * Add test cases for including (and not including) repository description in search. Signed-off-by: David Svantesson * Rename test function from TestSearchRepositoryByName to TestSearchRepository. Signed-off-by: David Svantesson * Make setting SEARCH_REPO_DESCRIPTION default to true Signed-off-by: David Svantesson --- modules/setting/setting.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'modules/setting/setting.go') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 77b8f20640..3ff9f89ad5 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -150,19 +150,20 @@ var ( // UI settings UI = struct { - ExplorePagingNum int - IssuePagingNum int - RepoSearchPagingNum int - FeedMaxCommitNum int - GraphMaxCommitNum int - CodeCommentLines int - ReactionMaxUserNum int - ThemeColorMetaTag string - MaxDisplayFileSize int64 - ShowUserEmail bool - DefaultShowFullName bool - DefaultTheme string - Themes []string + ExplorePagingNum int + IssuePagingNum int + RepoSearchPagingNum int + FeedMaxCommitNum int + GraphMaxCommitNum int + CodeCommentLines int + ReactionMaxUserNum int + ThemeColorMetaTag string + MaxDisplayFileSize int64 + ShowUserEmail bool + DefaultShowFullName bool + DefaultTheme string + Themes []string + SearchRepoDescription bool Admin struct { UserPagingNum int @@ -942,6 +943,7 @@ func NewContext() { UI.ShowUserEmail = Cfg.Section("ui").Key("SHOW_USER_EMAIL").MustBool(true) UI.DefaultShowFullName = Cfg.Section("ui").Key("DEFAULT_SHOW_FULL_NAME").MustBool(false) + UI.SearchRepoDescription = Cfg.Section("ui").Key("SEARCH_REPO_DESCRIPTION").MustBool(true) HasRobotsTxt = com.IsFile(path.Join(CustomPath, "robots.txt")) -- cgit v1.2.3