Projet

Général

Profil

0001-storage-apply-full-text-search-normalization-66032.patch

Thomas Noël, 08 juin 2022 00:18

Télécharger (1,67 ko)

Voir les différences:

Subject: [PATCH] storage: apply full text search normalization  (#66032)

 tests/api/test_formdata.py | 4 ++++
 wcs/qommon/storage.py      | 7 ++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
tests/api/test_formdata.py
864 864
    assert len(resp.json) == 2
865 865
    assert [int(x['id']) for x in resp.json] == [formdata3.id, formdata1.id]
866 866

  
867
    resp = get_app(pub).get(sign_uri('/api/forms/test/list?full=on&q=föô', user=local_user))
868
    assert len(resp.json) == 2
869
    assert [int(x['id']) for x in resp.json] == [formdata3.id, formdata1.id]
870

  
867 871

  
868 872
def test_api_list_formdata_unknown_filter(pub, local_user):
869 873
    pub.role_class.wipe()
wcs/qommon/storage.py
27 27
import tempfile
28 28
import time
29 29

  
30
import unidecode
30 31
from django.utils.encoding import force_bytes
31 32
from quixote import get_publisher
32 33

  
......
325 326

  
326 327
class FtsMatch(Criteria):
327 328
    def __init__(self, value):
328
        self.value = value
329
        self.value = self.get_fts_value(value)
330

  
331
    @classmethod
332
    def get_fts_value(cls, value):
333
        return unidecode.unidecode(value)
329 334

  
330 335
    def build_lambda(self):
331 336
        raise NotImplementedError()
332
-