fix(fts): full-text search should not retrieve files in trash bin (fix #3386)

pull/3461/head
Aaron Liu 4 months ago
parent 9792a5c84f
commit a9a0c1ee78

@ -126,6 +126,10 @@ func (f *File) SizeUsed() int64 {
}) })
} }
func (f *File) InTrashBin() bool {
return f.Root().Name() != inventory.RootFolderName
}
func (f *File) UpdatedAt() time.Time { func (f *File) UpdatedAt() time.Time {
return f.Model.UpdatedAt return f.Model.UpdatedAt
} }

@ -160,6 +160,7 @@ type (
Entities() []Entity Entities() []Entity
PrimaryEntity() Entity PrimaryEntity() Entity
PrimaryEntityID() int PrimaryEntityID() int
InTrashBin() bool
Shared() bool Shared() bool
IsSymbolic() bool IsSymbolic() bool
PolicyID() (id int) PolicyID() (id int)

@ -60,6 +60,10 @@ func (m *manager) SearchFullText(ctx context.Context, query string, offset int)
return FullTextSearchResult{}, false return FullTextSearchResult{}, false
} }
if file.InTrashBin() {
return FullTextSearchResult{}, false
}
return FullTextSearchResult{ return FullTextSearchResult{
File: file, File: file,
Content: result.Text, Content: result.Text,

Loading…
Cancel
Save