mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-29 00:55:51 +08:00
feature (search): cleanup
This commit is contained in:
@ -488,20 +488,22 @@ func(this *SearchIndexer) Discover() bool {
|
||||
|
||||
func(this *SearchIndexer) Indexing() bool {
|
||||
var path string
|
||||
err := this.db.QueryRow(
|
||||
// find some file that needs to be indexed
|
||||
var err error
|
||||
if err = this.db.QueryRow(
|
||||
"SELECT path FROM file WHERE (" +
|
||||
" type = 'file' AND size < 512000 AND filetype = 'txt' AND indexTime IS NULL" +
|
||||
") LIMIT 1;",
|
||||
).Scan(&path)
|
||||
if err != nil {
|
||||
).Scan(&path); err != nil {
|
||||
return false
|
||||
}
|
||||
defer this.db.Exec(
|
||||
"UPDATE file SET indexTime = ? WHERE path = ?",
|
||||
time.Now(), path,
|
||||
)
|
||||
|
||||
mime := GetMimeType(path)
|
||||
|
||||
// Index content
|
||||
var reader io.ReadCloser
|
||||
reader, err = this.Backend.Cat(path)
|
||||
if err != nil {
|
||||
@ -530,10 +532,6 @@ func(this SearchIndexer) Bookkeeping() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func(this SearchIndexer) Consolidate() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
type Document struct {
|
||||
Hash string `json:"-"`
|
||||
Type string `json:"type"`
|
||||
|
||||
Reference in New Issue
Block a user