[Answer]-Escape special characters using haystack SearchQuerySet and Solr

1👍

If you add in the analyzer this filter

<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true"    expand="true"/>

And do this in python code.

from haystack.inputs import Clean
clean_value = Clean('+')

look that didn’t escape the character.

Need to use filter not autoescape.

SearchQuerySet().filter(title_element=clean_value)

I had the same problem and it worked for me.

Leave a comment