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

WordPress Trac noreply at wordpress.org
Sun Sep 4 02:12:18 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 needs-unit-  |  Resolution:
  tests                                          |     Focuses:
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by joemcgill):

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


Comment:

 [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.

 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.

 Also, thanks @Kent Brockman for the suggestion to check out the Media
 Search Enhanced plugin. Doing so helped me get my head around what needed
 to happen here.

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


More information about the wp-trac mailing list