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
- turn off escaping
OR - unescape the characters when I want to use the results in a non-HTML context i.e. as plain text ?
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)