Closed struan closed 8 years ago
Just a comment asking for a comment, :speech_balloon: otherwise this looks good :+1:
This doesn't seem to be working on candidates.dc - e.g. searching for "Fiona O'Donnell" doesn't find https://candidates.democracyclub.org.uk/person/839/fiona-odonnell
@sjorford Thanks for pointing that out - this commit (390f7ded63d57efd4b8) is only in upstream, which is why the search fails on the DC fork. @symroe - I think if you cherry-pick that commit onto DC master, it should fix the problem there too, since:
curl "http://localhost:9200/_search?q=Fiona%20O%26%2339;Donnell&pretty=1"
... does find the candidate.
The search uses the text field in the index which is generated by Haystack and escapes the content as it goes in. Search terms were not being escaped which meant that names with an apostrophe in them never matched.
This escapes search terms so they should not match the values in the text field in the search index.
Fixes #862