Reputation: 2939
I'm using django-haystack with elasticsearch backend. The data contains names of books that may contain special characters like &
, '
or ""
. The indexed data escapes these characters and the search results shows the escaped data. How do I tell haystack or elasticsearch to
Here's my code:
#search_indexes.py
class Book(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
def get_model(self):
return Book
#template
{{object.name}}
#query
SearchQuerySet().autocomplete(text=my_query)
Upvotes: 1
Views: 193
Reputation: 1455
In your template you can use filters and tags like:
{% autoescape on %}
{{ object.name }}
{% endautoescape %}
or
{{ object.name|striptags }}
Upvotes: 1