Fix search form ending in dash error#2727
Conversation
On the search form if a user's search ends in a dash it will cause a server error. This change fixes this problem by trimming dashes and spaces from the end of the search term.
michalkleiner
left a comment
There was a problem hiding this comment.
To trim whitespaces is probably legitimate here, but I don't think we should be trimming potentially meaningful characters. It seems the problem here is that the hyphen in the keyword isn't escaped properly for the db query where it uses a minus to create a not predicate. So I'd prefer a fix taking that into account.
|
I've been looking at another similar scenario where FullTextSearch (site search) against something like ABC-123, where ABC-123 is in the content zone it yields no results. This is due to the not predicate from what I've seen thus far. I'm wondering if making the modifiers more flexible as right now I believe it simply looks for + or - and assumes you know what those do within the keyword string and how it affects the query. As a developer I didn't know that was the case so I'd guess CMS and end users would have no idea. |
|
The code that follows the initial keyword fetch shows that the code uses the I think escaping the On the other hand, stripping any dashes on the end of the whole search string shouldn't break anything. |
On the search form if a user's search ends in a dash it will cause a server error.
This change fixes this problem by trimming dashes and spaces from the end of the search term.