mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
forum: workaround for building index
This commit is contained in:
parent
347caa3b6a
commit
545671bec3
@ -57,8 +57,18 @@ class UserOnlySignalProcessor(signals.BaseSignalProcessor):
|
||||
models.signals.post_delete.disconnect(self.handle_delete, sender=User)
|
||||
|
||||
|
||||
class BigCharFieldIndex(indexes.CharField):
|
||||
"""
|
||||
Workaround to avoid xapian.InvalidArgument: Term too long (> 245)
|
||||
See https://groups.google.com/forum/#!topic/django-haystack/hRJKcPNPXqw/discussion
|
||||
"""
|
||||
|
||||
def prepare(self, term):
|
||||
return super(BigCharFieldIndex, self).prepare(term)[:245]
|
||||
|
||||
|
||||
class ForumMessageIndex(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.CharField(document=True, use_template=True)
|
||||
text = BigCharFieldIndex(document=True, use_template=True)
|
||||
auto = indexes.EdgeNgramField(use_template=True)
|
||||
|
||||
def get_model(self):
|
||||
|
Loading…
Reference in New Issue
Block a user