Commit c3259a517612d10d96f5a9ca016c4a4754daa397

Authored by Luan
1 parent 18dc6253

Adding custom highlighter

src/colab/custom_settings.py
@@ -15,6 +15,8 @@ LANGUAGES = ( @@ -15,6 +15,8 @@ LANGUAGES = (
15 15
16 LANGUAGE_CODE = 'pt-br' 16 LANGUAGE_CODE = 'pt-br'
17 17
  18 +HAYSTACK_CUSTOM_HIGHLIGHTER = 'colab.utils.highlighting.ColabHighlighter'
  19 +
18 HAYSTACK_CONNECTIONS = { 20 HAYSTACK_CONNECTIONS = {
19 'default': { 21 'default': {
20 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', 22 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
src/colab/utils/__init__.py 0 → 100644
src/colab/utils/highlighting.py 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +from haystack.utils import Highlighter
  2 +
  3 +
  4 +class ColabHighlighter(Highlighter):
  5 + def find_window(self, highlight_locations):
  6 + return (0, self.max_length)
src/static/css/screen.css
@@ -369,3 +369,8 @@ ul.emails { @@ -369,3 +369,8 @@ ul.emails {
369 } 369 }
370 370
371 /* end user profile update */ 371 /* end user profile update */
  372 +
  373 +/* search highlighting */
  374 +span.highlighted {
  375 + background-color: yellow;
  376 +}