From c3259a517612d10d96f5a9ca016c4a4754daa397 Mon Sep 17 00:00:00 2001 From: Luan Date: Sun, 13 Oct 2013 00:11:25 -0300 Subject: [PATCH] Adding custom highlighter --- src/colab/custom_settings.py | 2 ++ src/colab/utils/__init__.py | 0 src/colab/utils/highlighting.py | 6 ++++++ src/static/css/screen.css | 5 +++++ 4 files changed, 13 insertions(+), 0 deletions(-) create mode 100644 src/colab/utils/__init__.py create mode 100644 src/colab/utils/highlighting.py diff --git a/src/colab/custom_settings.py b/src/colab/custom_settings.py index b297d41..cf40c21 100644 --- a/src/colab/custom_settings.py +++ b/src/colab/custom_settings.py @@ -15,6 +15,8 @@ LANGUAGES = ( LANGUAGE_CODE = 'pt-br' +HAYSTACK_CUSTOM_HIGHLIGHTER = 'colab.utils.highlighting.ColabHighlighter' + HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', diff --git a/src/colab/utils/__init__.py b/src/colab/utils/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/colab/utils/__init__.py diff --git a/src/colab/utils/highlighting.py b/src/colab/utils/highlighting.py new file mode 100644 index 0000000..f90f713 --- /dev/null +++ b/src/colab/utils/highlighting.py @@ -0,0 +1,6 @@ +from haystack.utils import Highlighter + + +class ColabHighlighter(Highlighter): + def find_window(self, highlight_locations): + return (0, self.max_length) diff --git a/src/static/css/screen.css b/src/static/css/screen.css index 96c47ee..6c8d701 100644 --- a/src/static/css/screen.css +++ b/src/static/css/screen.css @@ -369,3 +369,8 @@ ul.emails { } /* end user profile update */ + +/* search highlighting */ +span.highlighted { + background-color: yellow; +} -- libgit2 0.21.2