Skip to content

Commit

Permalink
chore (maintain): maintain sqlite full text search plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-kerjean committed Nov 22, 2023
1 parent 9323c73 commit 253cb8c
Show file tree
Hide file tree
Showing 179 changed files with 111,663 additions and 54,228 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/gorilla/websocket v1.4.1
github.com/h2non/bimg v1.1.5
github.com/hirochachacha/go-smb2 v1.1.0
github.com/mattn/go-sqlite3 v2.0.2+incompatible
github.com/mattn/go-sqlite3 v1.14.18
github.com/mickael-kerjean/net v0.0.0-20191120063050-2457c043ba06
github.com/mickael-kerjean/saml v0.0.0-20221221152539-19783715740c
github.com/mitchellh/hashstructure v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ github.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxq
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI=
github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mattn/go-sqlite3 v2.0.2+incompatible h1:qzw9c2GNT8UFrgWNDhCTqRqYUSmu/Dav/9Z58LGpk7U=
github.com/mattn/go-sqlite3 v2.0.2+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mickael-kerjean/net v0.0.0-20191120063050-2457c043ba06 h1:427Mpu5edwuFuDBdqOm6EgRohYqZ9Oomd+87ryW2Uls=
Expand Down
12 changes: 9 additions & 3 deletions server/plugin/plg_search_sqlitefts/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ var (
CYCLE_TIME func() int
INDEXING_EXT func() string
MAX_INDEXING_FSIZE func() int
INDEXING_EXCLUSION = []string{"/node_modules/", "/bower_components/", "/.cache/", "/.npm/", "/.git/"}
INDEXING_EXCLUSION = []string{
"/node_modules/", "/bower_components/",
"/.cache/", "/.npm/", "/.git/",
}
)

func init() {
Expand All @@ -24,7 +27,10 @@ func init() {
}
f.Name = "enable"
f.Type = "enable"
f.Target = []string{"process_max", "process_par", "reindex_time", "cycle_time", "max_size", "indexer_ext"}
f.Target = []string{
"process_max", "process_par", "reindex_time",
"cycle_time", "max_size", "indexer_ext",
}
f.Description = "Enable/Disable full text search"
f.Placeholder = "Default: false"
f.Default = false
Expand Down Expand Up @@ -114,7 +120,7 @@ func init() {
}
f.Id = "indexer_ext"
f.Name = "indexer_ext"
f.Type = "string"
f.Type = "text"
f.Description = "File extension we want to see indexed"
f.Placeholder = "Default: org,txt,docx,pdf,md,form"
f.Default = "org,txt,docx,pdf,md,form"
Expand Down
32 changes: 16 additions & 16 deletions server/plugin/plg_search_sqlitefts/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,39 +75,39 @@ func (this SqliteSearch) Query(app App, path string, keyword string) ([]IFile, e

type SearchHint struct{}

func (this SearchHint) Ls(ctx App, path string) error {
go SProc.HintLs(&ctx, path)
func (this SearchHint) Ls(ctx *App, path string) error {
go SProc.HintLs(ctx, path)
return nil
}

func (this SearchHint) Cat(ctx App, path string) error {
go SProc.HintLs(&ctx, filepath.Dir(path)+"/")
func (this SearchHint) Cat(ctx *App, path string) error {
go SProc.HintLs(ctx, filepath.Dir(path)+"/")
return nil
}

func (this SearchHint) Mkdir(ctx App, path string) error {
go SProc.HintLs(&ctx, filepath.Dir(path)+"/")
func (this SearchHint) Mkdir(ctx *App, path string) error {
go SProc.HintLs(ctx, filepath.Dir(path)+"/")
return nil
}

func (this SearchHint) Rm(ctx App, path string) error {
go SProc.HintRm(&ctx, path)
func (this SearchHint) Rm(ctx *App, path string) error {
go SProc.HintRm(ctx, path)
return nil
}

func (this SearchHint) Mv(ctx App, from string, to string) error {
go SProc.HintRm(&ctx, filepath.Dir(from)+"/")
go SProc.HintLs(&ctx, filepath.Dir(to)+"/")
func (this SearchHint) Mv(ctx *App, from string, to string) error {
go SProc.HintRm(ctx, filepath.Dir(from)+"/")
go SProc.HintLs(ctx, filepath.Dir(to)+"/")
return nil
}

func (this SearchHint) Save(ctx App, path string) error {
go SProc.HintLs(&ctx, filepath.Dir(path)+"/")
go SProc.HintFile(&ctx, path)
func (this SearchHint) Save(ctx *App, path string) error {
go SProc.HintLs(ctx, filepath.Dir(path)+"/")
go SProc.HintFile(ctx, path)
return nil
}

func (this SearchHint) Touch(ctx App, path string) error {
go SProc.HintLs(&ctx, filepath.Dir(path)+"/")
func (this SearchHint) Touch(ctx *App, path string) error {
go SProc.HintLs(ctx, filepath.Dir(path)+"/")
return nil
}
Loading

0 comments on commit 253cb8c

Please sign in to comment.