You can now disable the search subsystem.

Try Travis with MariaDB 12...
This commit is contained in:
Azareal 2019-02-23 16:55:34 +10:00
parent 6b56d69fc8
commit cf4a9d1738
6 changed files with 13 additions and 6 deletions

View File

@ -24,4 +24,4 @@ script: ./run-linux-tests
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
addons:
mariadb: '10.0'
mariadb: '12.0'

View File

@ -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

View File

@ -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.

View File

@ -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
}
}

View File

@ -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 {

View File

@ -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()