Skip to content

Commit

Permalink
Knowledge base search is case sensitive (infiniflow#797)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?
infiniflow#793 
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh committed May 16, 2024
1 parent 10e83f2 commit 1c4e92e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/db/services/document_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import random
from datetime import datetime
from elasticsearch_dsl import Q
from peewee import fn

from api.settings import stat_logger
from api.utils import current_timestamp, get_format_time
Expand All @@ -40,8 +41,9 @@ def get_by_kb_id(cls, kb_id, page_number, items_per_page,
orderby, desc, keywords):
if keywords:
docs = cls.model.select().where(
cls.model.kb_id == kb_id,
cls.model.name.like(f"%%{keywords}%%"))
(cls.model.kb_id == kb_id),
(fn.LOWER(cls.model.name).contains(keywords.lower()))
)
else:
docs = cls.model.select().where(cls.model.kb_id == kb_id)
count = docs.count()
Expand Down

0 comments on commit 1c4e92e

Please sign in to comment.