mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
31 lines
787 B
Go
31 lines
787 B
Go
package plg_search_stateless
|
|
|
|
import (
|
|
"fmt"
|
|
. "github.com/mickael-kerjean/filestash/server/common"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
SEARCH_TIMEOUT func() time.Duration
|
|
)
|
|
|
|
func init() {
|
|
SEARCH_TIMEOUT = func() time.Duration {
|
|
return time.Duration(Config.Get("features.search.explore_timeout").Schema(func(f *FormElement) *FormElement {
|
|
if f == nil {
|
|
f = &FormElement{}
|
|
}
|
|
f.Name = "explore_timeout"
|
|
f.Type = "number"
|
|
f.Default = 1500
|
|
f.Description = `When full text search is disabled, the search engine recursively explore
|
|
directories to find results. Exploration can't last longer than what is configured here`
|
|
f.Placeholder = fmt.Sprintf("Default: %dms", f.Default)
|
|
return f
|
|
}).Int()) * time.Millisecond
|
|
}
|
|
Hooks.Register.Onload(func() {
|
|
SEARCH_TIMEOUT()
|
|
})
|
|
}
|