[wp-trac] [WordPress Trac] #36195: Search for something with ' - ' will always return nothing

WordPress Trac noreply at wordpress.org
Thu Mar 10 15:48:27 UTC 2016


#36195: Search for something with ' - ' will always return nothing
--------------------------+-----------------------------
 Reporter:  RomSocial     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.4.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36195>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list