mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 06:05:59 +08:00
Knowledge base search is case sensitive (#797)
### What problem does this PR solve? #793 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
10e83f26dc
commit
1c4e92ed35
@ -16,6 +16,7 @@
|
|||||||
import random
|
import random
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from elasticsearch_dsl import Q
|
from elasticsearch_dsl import Q
|
||||||
|
from peewee import fn
|
||||||
|
|
||||||
from api.settings import stat_logger
|
from api.settings import stat_logger
|
||||||
from api.utils import current_timestamp, get_format_time
|
from api.utils import current_timestamp, get_format_time
|
||||||
@ -40,8 +41,9 @@ class DocumentService(CommonService):
|
|||||||
orderby, desc, keywords):
|
orderby, desc, keywords):
|
||||||
if keywords:
|
if keywords:
|
||||||
docs = cls.model.select().where(
|
docs = cls.model.select().where(
|
||||||
cls.model.kb_id == kb_id,
|
(cls.model.kb_id == kb_id),
|
||||||
cls.model.name.like(f"%%{keywords}%%"))
|
(fn.LOWER(cls.model.name).contains(keywords.lower()))
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
docs = cls.model.select().where(cls.model.kb_id == kb_id)
|
docs = cls.model.select().where(cls.model.kb_id == kb_id)
|
||||||
count = docs.count()
|
count = docs.count()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user