search

package module
v0.0.0-...-20125a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DirectiveName = "search"

Variables

This section is empty.

Functions

func CreateIndex

func CreateIndex() (bleve.Index, error)

Types

type NotifyFile

type NotifyFile struct {
	// contains filtered or unexported fields
}

func NewNotifyFile

func NewNotifyFile(logger *zap.Logger, indexFunc func(path string, remove bool)) *NotifyFile

func (*NotifyFile) WatchDir

func (nf *NotifyFile) WatchDir(dir string) error

WatchDir 监控目录

func (*NotifyFile) WatchEvent

func (nf *NotifyFile) WatchEvent()

type Result

type Result struct {
	Path string
	Body []string
}
type Search struct {
	Root     string `json:"root,omitempty"`
	Endpoint string `json:"endpoint,omitempty"` // default: /search
	Regexp   string `json:"regexp,omitempty"`
	// contains filtered or unexported fields
}

func (Search) CaddyModule

func (Search) CaddyModule() caddy.ModuleInfo

func (*Search) IndexDoc

func (sch *Search) IndexDoc(path string, remove bool)

IndexDoc 索引文件

func (*Search) Provision

func (sch *Search) Provision(ctx caddy.Context) error

Provision sets up the module. #caddy.Provisioner

func (*Search) Search

func (sch *Search) Search(queryStr string) map[string][]string

Search 搜索文件

func (*Search) SearchHTML

func (sch *Search) SearchHTML(w http.ResponseWriter, r *http.Request) error

SearchHTML renders the search results in the HTML template

func (*Search) SearchJSON

func (sch *Search) SearchJSON(w http.ResponseWriter, r *http.Request) error

SearchJSON renders the search results in JSON format

func (*Search) ServeHTTP

func (sch *Search) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) (err error)

ServeHTTP implements #caddyhttp.MiddlewareHandler.

func (*Search) Validate

func (sch *Search) Validate() error

Validate ensures md has a valid configuration. #caddy.Validator Validate should be a read-only function. It is run after the Provision() method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL