mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-04 05:27:04 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			500 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			500 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package plg_search_example
 | 
						|
 | 
						|
import (
 | 
						|
	. "github.com/mickael-kerjean/filestash/server/common"
 | 
						|
)
 | 
						|
 | 
						|
func init() {
 | 
						|
	Hooks.Register.SearchEngine(ExampleSearch{})
 | 
						|
}
 | 
						|
 | 
						|
type ExampleSearch struct{}
 | 
						|
 | 
						|
func (this ExampleSearch) Query(app App, path string, keyword string) ([]IFile, error) {
 | 
						|
	files := []IFile{}
 | 
						|
	files = append(files, File{
 | 
						|
		FName: "keyword-" + keyword + ".txt",
 | 
						|
		FType: "file", // ENUM("file", "directory")
 | 
						|
		FSize: 42,
 | 
						|
		FPath: "/fullpath/keyword-" + keyword + ".txt",
 | 
						|
	})
 | 
						|
	return files, nil
 | 
						|
}
 |