Documentation ¶
Index ¶
- func ConvertToRegExp(rexp []string) (r []*regexp.Regexp)
- func GetUrlPath(u *url.URL) string
- func NewIndexer(engine string, config indexer.Config, analyzer string) (index indexer.Handler, err error)
- func ScanToPipe(fp string, indexManager *IndexerManager, index indexer.Handler) indexer.Record
- type IndexerManager
- type QueryResults
- type Result
- type Search
- func (*Search) CaddyModule() caddy.ModuleInfo
- func (m *Search) Cleanup() error
- func (search *Search) Provision(ctx caddy.Context) (err error)
- func (s *Search) SearchHTML(w http.ResponseWriter, r *http.Request) error
- func (s *Search) SearchJSON(w http.ResponseWriter, r *http.Request) error
- func (s *Search) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m *Search) StartWatcher(fp string, indexManager *IndexerManager, index indexer.Handler)
- func (m *Search) UnmarshalCaddyfile(c *caddyfile.Dispenser) error
- func (m *Search) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToRegExp ¶
ConvertToRegExp compile a string regular expression to multiple *regexp.Regexp instances
func GetUrlPath ¶
func NewIndexer ¶
func NewIndexer(engine string, config indexer.Config, analyzer string) (index indexer.Handler, err error)
NewIndexer creates a new Indexer with the received config
func ScanToPipe ¶
ScanToPipe ...
Types ¶
type IndexerManager ¶
type IndexerManager struct { MaxFileSize int // contains filtered or unexported fields }
IndexerManager is the structure that holds search's pipeline infos and methods
func NewIndexerManager ¶
func NewIndexerManager(config *Search, MaxFileSize int, indxr indexer.Handler) (*IndexerManager, error)
NewIndexerManager creates a new Pipeline instance
func (*IndexerManager) Feed ¶
func (p *IndexerManager) Feed(record indexer.Record)
Feed is the step of the pipeline that feeds valid documents to the indexer.
func (*IndexerManager) ValidatePath ¶
func (p *IndexerManager) ValidatePath(path string) bool
ValidatePath is the method that checks if the target page can be indexed
type QueryResults ¶
type QueryResults struct { httpserver.Context Query string Results []Result }
type Result ¶
type Result struct { Path string Title string Body template.HTML Json string Modified time.Time Indexed time.Time From int Size int }
Result is the structure for the search result
type Search ¶
type Search struct { DbName string Engine string IncludePathsStr []string ExcludePathsStr []string Endpoint string IndexDirectory string TemplateRaw string Expire time.Duration SiteRoot string NumWorkers int Analyzer string MaxSizeFile int FileWatcher bool Indexer indexer.Handler IndexManager *IndexerManager IncludePaths []*regexp.Regexp ExcludePaths []*regexp.Regexp Template *template.Template // contains filtered or unexported fields }
Search represents this middleware structure
func (*Search) CaddyModule ¶
func (*Search) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Search) SearchHTML ¶
SearchHTML renders the search results in the HTML template
func (*Search) SearchJSON ¶
SearchJSON renders the search results in JSON format
func (*Search) StartWatcher ¶
func (m *Search) StartWatcher(fp string, indexManager *IndexerManager, index indexer.Handler)
func (*Search) UnmarshalCaddyfile ¶
UnmarshalCaddyfile implements caddyfile.Unmarshaler.