2022-11-28 05:45:25 +00:00
|
|
|
package searcher
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/alist-org/alist/v3/internal/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Name string
|
|
|
|
AutoUpdate bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type Searcher interface {
|
|
|
|
// Config of the searcher
|
|
|
|
Config() Config
|
|
|
|
// Search specific keywords in specific path
|
|
|
|
Search(ctx context.Context, req model.SearchReq) ([]model.SearchNode, int64, error)
|
|
|
|
// Index obj with parent
|
2022-11-28 13:08:11 +00:00
|
|
|
Index(ctx context.Context, node model.SearchNode) error
|
2022-12-11 06:59:58 +00:00
|
|
|
// BatchIndex obj with parent
|
2022-12-05 05:28:39 +00:00
|
|
|
BatchIndex(ctx context.Context, nodes []model.SearchNode) error
|
2022-11-28 05:45:25 +00:00
|
|
|
// Get by parent
|
|
|
|
Get(ctx context.Context, parent string) ([]model.SearchNode, error)
|
|
|
|
// Del with prefix
|
|
|
|
Del(ctx context.Context, prefix string) error
|
|
|
|
// Release resource
|
|
|
|
Release(ctx context.Context) error
|
|
|
|
// Clear all index
|
|
|
|
Clear(ctx context.Context) error
|
|
|
|
}
|