[wp-trac] [WordPress Trac] #27266: Front end search for attachment title cannot succeed

WordPress Trac noreply at wordpress.org
Mon Mar 3 20:58:33 UTC 2014


#27266: Front end search for attachment title cannot succeed
--------------------------+-----------------------------
 Reporter:  dglingren     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This is somewhat related to ticket #22556 but affects all queries that use
 the keyword search parameter, 's'.

 Typing an attachment's title into the "front end" search box generated
 this query:

 {{{
 SELECT SQL_CALC_FOUND_ROWS mladev_posts.ID
 FROM mladev_posts
 WHERE 1=1
 AND (((mladev_posts.post_title LIKE '%Guatemala%')
 OR (mladev_posts.post_content LIKE '%Guatemala%'))
 AND ((mladev_posts.post_title LIKE '%IRF3%')
 OR (mladev_posts.post_content LIKE '%IRF3%')))
 AND mladev_posts.post_type IN ('post', 'page', 'attachment')
 AND (mladev_posts.post_status = 'publish'
 OR mladev_posts.post_author = 1
 AND mladev_posts.post_status = 'private')
 ORDER BY (CASE
 WHEN mladev_posts.post_title LIKE '%Guatemala IRF3%'
 THEN 1
 WHEN mladev_posts.post_title LIKE '%Guatemala%'
 AND mladev_posts.post_title LIKE '%IRF3%'
 THEN 2
 WHEN mladev_posts.post_title LIKE '%Guatemala%'
 OR mladev_posts.post_title LIKE '%IRF3%'
 THEN 3
 WHEN mladev_posts.post_content LIKE '%Guatemala IRF3%'
 THEN 4
 ELSE 5 END), mladev_posts.post_date DESC
 LIMIT 0, 2
 }}}

 Although the `post_type` clause includes attachment, the `post_status`
 test always fails because attachments have a `post_status` of inherit.

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


More information about the wp-trac mailing list