Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Set active language during haystack indexing #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aldryn_people/search_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.conf import settings

from aldryn_search.utils import get_index_base, strip_tags
from parler.utils.context import switch_language

from .models import Person

Expand All @@ -31,4 +32,6 @@ def get_model(self):
return Person

def get_search_data(self, obj, language, request):
return strip_tags(self.get_description(obj)).strip()
with switch_language(obj, language):
description = self.get_description(obj)
return strip_tags(description).strip()