migrations

This commit is contained in:
2018-03-15 12:42:13 +01:00
parent 29e19deebc
commit 25001e38c9
419 changed files with 44849 additions and 2142 deletions

17
src/project/search.py Normal file
View File

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from aldryn_search.base import AldrynIndexBase
from haystack import indexes
from haystack.utils.highlighting import Highlighter as _Highlighter
class SearchIndex(AldrynIndexBase):
text = indexes.NgramField(document=True, use_template=False)
class Highlighter(_Highlighter):
def render_html(self, highlight_locations=None, start_offset=None, end_offset=None):
return super(Highlighter, self).render_html(
highlight_locations=highlight_locations,
start_offset=max(0, start_offset - 20),
end_offset=end_offset + 20
)