[wp-trac] [WordPress Trac] #22744: Media search doesn't include file name

WordPress Trac noreply at wordpress.org
Mon Sep 5 10:30:39 UTC 2016


#22744: Media search doesn't include file name
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:
     Type:  enhancement                          |  wonderboymusic
 Priority:  normal                               |      Status:  reviewing
Component:  Media                                |   Milestone:  4.7
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch needs-testing has-unit-    |  Resolution:
  tests                                          |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:  has-patch needs-testing needs-unit-tests => has-patch needs-
     testing has-unit-tests


Comment:

 Replying to [comment:27 joemcgill]:
 > [attachment:22744.4.diff] Accomplishes this task without introducing any
 new filters. To do so, any time we execute a search query on attachments
 we modify the JOIN clause to include postmeta, the WHERE clause to include
 searches for postmeta where `_wp_attached_file` is the `meta_key` and the
 GROUP BY clause to avoid returning duplicate posts.

 Thanks for the refreshed patch! In [attachment:22744.5.diff] I made it
 work with `post_type` being an array too. Added a test to demonstrate it.

 > One question is whether we should search attachment file names any time
 `attachment` post types are included in a search query, e.g.
 `$q['post_type'] => array('attachment', 'post')`, or only when exclusively
 doing searches on attachments? Currently, I'm only doing the latter.

 Since this ticket is mainly about the media screen, I think fixing it only
 there for now is fine. It can be considered in #27266, even though that
 ticket is only slightly connected.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22744#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list