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