Bug #15648
closed
This bug is caused when searching for multiple terms due to unnecessary sanitizing of the search terms. I've just fixed this in the following commit: https://github.com/cuny-academic-commons/cac/commit/a46e75d365d46ab95adf76215a5250d694b5fffb. This should fix the immediate issue. I'm going to push this fix to 1.19.x
branch as well.
As far as searching with quotations around the search term, forum search (and WordPress) doesn't support this functionality natively. Was surprised to find that no-one had attempted to add this functionality, so I've written some code to allow searches wrapped with double quotations here: https://gist.github.com/r-a-y/f66042d63970a1058a4e380e31f8463b. What I'm doing in this code snippet is removing double-quoted search terms from the 's'
field and then appending the double-quoted search term to the end of the SQL query. Boone, can you take a look to see if there are any problems with this approach before I commit this? I've opted to do this sitewide, rather than limit this functionality to forum search because I think this would be really beneficial on the frontend as well as in the admin area. But if we wanted to only limit this to forum search, we could do that as well.
When combined with WP's native exclusion search terms support, it would be possible to do a search like this:
"match this" -notthis -orthis
So the search would include posts for match this
exactly and omit posts including notthis
or orthis
. This could really help users trying to find something specific.
- Status changed from New to Staged for Production Release
I've added the code snippet here: https://github.com/cuny-academic-commons/cac/commit/2d4cb987d1b8ec0671dfc4d8ea2f3b070b2b6d52.
Double-quoted searches can now be tested on cdev. Try in a group forum or if you are an administrator of a sub-site, try doing a double-quoted search when on the "Posts" admin dashboard page. On the "Appearance > Widgets" page, you can also add the "Search" widget to your site; then on the frontend, you can use the Search widget to do a double-quoted search as well.
- Status changed from Staged for Production Release to Resolved
Also available in: Atom
PDF