Opened 9 years ago
Closed 9 years ago
#36195 closed defect (bug) (fixed)
Search for something with ' - ' will always return nothing
Reported by: | RomSocial | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.4.3 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Query | Keywords: | fixed-major |
Focuses: | Cc: |
Description
On fresh Wordpress install with stock theme, if I create post with the title:
"Great new post - now!" and publish it,
And I search for "Great new post" it will work.
But if I search for "Great new post - now" with or without quotes it will not work.
Even if I search for "Great new post – now" with or without quotes it returns nothing.
that seems to be happening because ' - ' gets converted to:
AND ((wp_posts.post_title NOT LIKE '%%') AND (wp_posts.post_content NOT LIKE '%%'))
And even though ndash gets converted into:
AND ((wp_posts.post_title LIKE '%–%') OR (wp_posts.post_content LIKE '%–%'))
it's not in the database either.
So, I would suggest to patch the
/wp-includes/query.php:2180 --- $include = '-' !== substr( $term, 0, 1 ); +++ $include = '-' !== substr( $term, 0, 1 ) || strlen($term) == 1;
Or something to this effect.
Attachments (1)
Change History (8)
#1
@
9 years ago
- Keywords has-patch has-unit-tests added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.4.2 to 4.4
#3
follow-up:
↓ 4
@
9 years ago
@boonebgorges Wasn't $s
updated to support excluded search terms in 4.4?
#4
in reply to:
↑ 3
@
9 years ago
- Milestone changed from Future Release to 4.4.3
- Owner set to boonebgorges
- Status changed from new to assigned
Replying to swissspidy:
@boonebgorges Wasn't
$s
updated to support excluded search terms in 4.4?
Oh right. Whoops. Let's slate this for a potential 4.4.3. It's minor but definitely a regression.
@RomSocial Thanks for the helpful bug report, and welcome to WordPress Trac!
@swissspidy I see you changed the version to 4.4 - is this a regression in 4.4?