diff --git a/Makefile b/Makefile index c51ded1..c747862 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,9 @@ release: reindex: docker-compose exec web ./manage.py update_index +clear_index: + docker-compose exec elasticsearch curl -XDELETE localhost:9200/_all + django-exec-bash: # execute bash in the currently running container docker-compose exec web bash diff --git a/publichealth/home/models/models.py b/publichealth/home/models/models.py index 22ff706..03c4c55 100644 --- a/publichealth/home/models/models.py +++ b/publichealth/home/models/models.py @@ -11,6 +11,7 @@ from wagtail.wagtailcore.fields import StreamField, RichTextField from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel, MultiFieldPanel from wagtail.wagtailimages.blocks import ImageChooserBlock from wagtail.wagtailimages.edit_handlers import ImageChooserPanel +from wagtail.wagtailsearch import index from puput.models import EntryPage @@ -110,6 +111,14 @@ class ArticlePage(Page): related_name='+' ) + search_fields = Page.search_fields + [ + index.SearchField('title', partial_match=True, boost=10), + index.SearchField('title_fr', partial_match=True, boost=10), + index.SearchField('body_de', partial_match=True), + index.SearchField('body_fr', partial_match=True), + index.SearchField('intro_de', partial_match=True), + index.SearchField('intro_fr', partial_match=True), + ] content_panels = [ MultiFieldPanel([ FieldPanel('title'), diff --git a/publichealth/home/templatetags/navigation.py b/publichealth/home/templatetags/navigation.py index 5bd7d5e..7ea6d0f 100644 --- a/publichealth/home/templatetags/navigation.py +++ b/publichealth/home/templatetags/navigation.py @@ -7,10 +7,12 @@ register = template.Library() # Language switcher @register.inclusion_tag('tags/language.html', takes_context=True) def language_switcher(context): - url = context['page'].url.split('/') - if len(url) > 2 and len(url[1]) >= 2: - url[1] = '$lang$' - url = '/'.join(url) + url = '/$lang$' + if 'page' in context: + url = context['page'].url.split('/') + if len(url) > 2 and len(url[1]) >= 2: + url[1] = '$lang$' + url = '/'.join(url) return { 'languages': [ { 'code': 'de', 'title': 'De', 'url': url.replace('$lang$','de') }, diff --git a/publichealth/search/templates/search/search.html b/publichealth/search/templates/search/search.html index faa5d37..93f36c2 100644 --- a/publichealth/search/templates/search/search.html +++ b/publichealth/search/templates/search/search.html @@ -10,7 +10,7 @@
- + @@ -53,7 +53,7 @@ {{ search_results.next_page_number }} {% endif %} {% elif search_query %} - Leider keine Ergebnisse / Désolé, aucun résultat n'a été trouvé +
Leider keine Ergebnisse gefunden

Désolé, aucun résultat n'a été trouvé
{% endif %}
diff --git a/publichealth/static/css/modules/_forms.scss b/publichealth/static/css/modules/_forms.scss index 705f234..50a9d53 100644 --- a/publichealth/static/css/modules/_forms.scss +++ b/publichealth/static/css/modules/_forms.scss @@ -46,3 +46,15 @@ } } + +#search-page { + input[type='text'] { + font-size: 110%; + } + h4 { + margin-bottom: 0px; + } + .container > center { + margin-bottom: 3em; + } +}