mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
forum: workaround for error while indexing badly encoded text (legacy)
This commit is contained in:
parent
545671bec3
commit
269242601a
@ -29,6 +29,8 @@ from haystack import indexes, signals
|
||||
from core.models import User
|
||||
from forum.models import ForumMessage
|
||||
|
||||
from unicodedata import normalize
|
||||
|
||||
|
||||
class UserIndex(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.CharField(document=True, use_template=True)
|
||||
@ -64,7 +66,7 @@ class BigCharFieldIndex(indexes.CharField):
|
||||
"""
|
||||
|
||||
def prepare(self, term):
|
||||
return super(BigCharFieldIndex, self).prepare(term)[:245]
|
||||
return normalize("NFKC", super(BigCharFieldIndex, self).prepare(term))[:245]
|
||||
|
||||
|
||||
class ForumMessageIndex(indexes.SearchIndex, indexes.Indexable):
|
||||
|
Loading…
Reference in New Issue
Block a user