From cf4a9d173887d79d5c0fa5d31554a2e99e349d4e Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 23 Feb 2019 16:55:34 +1000 Subject: [PATCH] You can now disable the search subsystem. Try Travis with MariaDB 12... --- .travis.yml | 2 +- common/site.go | 2 ++ docs/configuration.md | 2 ++ install/mysql.go | 3 ++- main.go | 8 +++++--- routes/topic_list.go | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a4cfda5..3d8164b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,4 +24,4 @@ script: ./run-linux-tests after_script: - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT addons: - mariadb: '10.0' \ No newline at end of file + mariadb: '12.0' \ No newline at end of file diff --git a/common/site.go b/common/site.go index c818a832..c239b3ae 100644 --- a/common/site.go +++ b/common/site.go @@ -72,6 +72,8 @@ type config struct { SMTPPort string //SMTPEnableTLS bool + Search string + DefaultPath string DefaultGroup int // Should be a setting in the database ActivationGroup int // Should be a setting in the database diff --git a/docs/configuration.md b/docs/configuration.md index eebdf5c3..3c38ef2b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -42,6 +42,8 @@ SMTPPassword - The password for the SMTP server. SMTPPort - The port for the SMTP server, usually 25. +Search - The type of search system to use. Options: disabled, sql (default) + MaxRequestSizeStr - The maximum size that a request made to Gosora can be. This includes uploads. Example: 5MB UserCache - The type of user cache you want to use. You can leave this blank to disable this feature or use `static` for a small in-memory cache. diff --git a/install/mysql.go b/install/mysql.go index b3a1cea8..f421a0a9 100644 --- a/install/mysql.go +++ b/install/mysql.go @@ -1,7 +1,7 @@ /* * * Gosora MySQL Interface -* Copyright Azareal 2017 - 2019 +* Copyright Azareal 2017 - 2020 * */ package install @@ -137,6 +137,7 @@ func (ins *MysqlInstaller) TableDefs() (err error) { _, err = ins.db.Exec(string(data)) if err != nil { fmt.Println("Failed query:", string(data)) + panic("Failed query:", string(data)) return err } } diff --git a/main.go b/main.go index 999f71b6..c21db44e 100644 --- a/main.go +++ b/main.go @@ -143,9 +143,11 @@ func afterDBInit() (err error) { if err != nil { return errors.WithStack(err) } - common.RepliesSearch, err = common.NewSQLSearcher(acc) - if err != nil { - return errors.WithStack(err) + if common.Config.Search == "" || common.Config.Search == "sql" { + common.RepliesSearch, err = common.NewSQLSearcher(acc) + if err != nil { + return errors.WithStack(err) + } } common.Subscriptions, err = common.NewDefaultSubscriptionStore() if err != nil { diff --git a/routes/topic_list.go b/routes/topic_list.go index df4c783a..339aa639 100644 --- a/routes/topic_list.go +++ b/routes/topic_list.go @@ -69,7 +69,7 @@ func TopicListCommon(w http.ResponseWriter, r *http.Request, user common.User, h var forumList []common.Forum var paginator common.Paginator q := r.FormValue("q") - if q != "" { + if q != "" && common.RepliesSearch != nil { var canSee []int if user.IsSuperAdmin { canSee, err = common.Forums.GetAllVisibleIDs()