Bläddra i källkod

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)
tags/v0.6.0
KevinHuSh 1 år sedan
förälder
incheckning
1c4e92ed35
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4
    2
      api/db/services/document_service.py

+ 4
- 2
api/db/services/document_service.py Visa fil

@@ -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
@@ -40,8 +41,9 @@ class DocumentService(CommonService):
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()

Laddar…
Avbryt
Spara