I'm working on an existing Django project which uses haystack with xapian backend for a global search feature. However the search seems to fail while I search with some special characters like & and spaces etc. I tried but could not find out a way to fix it.
Is there a way I can escape these characters and make the search work? I'm using PostgreSQL at the back-end. Any pointers will be very helpful.
Update: Search feature uses a SearchForm and the query string comes in q field of the from. This is used as below in the code.
sqs = self.searchqueryset.auto_query(self.cleaned_data['q'])
I've tried using:
sqs = self.searchqueryset.filter(self.cleaned_data['q'])
and
sqs = self.searchqueryset.filter(content=Clean(self.cleaned_data['q']))
with no luck. I'm still not able to search with spaces and special characters like &.