migrations
This commit is contained in:
17
src/project/search.py
Normal file
17
src/project/search.py
Normal 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
|
||||
)
|
||||
Reference in New Issue
Block a user