fix bugs in searching file using keywords (#780)

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
KevinHuSh 2024-05-15 12:51:57 +08:00 committed by GitHub
parent 626ace8639
commit d8c080ee52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -34,9 +34,9 @@ class FileService(CommonService):
orderby, desc, keywords):
if keywords:
files = cls.model.select().where(
(cls.model.tenant_id == tenant_id)
(cls.model.tenant_id == tenant_id),
(cls.model.parent_id == pf_id),
(fn.LOWER(cls.model.name).like(f"%%{keywords.lower()}%%")),
(fn.LOWER(cls.model.name).contains(keywords.lower())),
~(cls.model.id == pf_id)
)
else:

View File

@ -96,7 +96,7 @@ class TaskService(CommonService):
return doc.run == TaskStatus.CANCEL.value or doc.progress < 0
except Exception as e:
pass
return True
return False
@classmethod
@DB.connection_context()