[wp-trac] [WordPress Trac] #39358: Media search speed has been dramatically reduced

WordPress Trac noreply at wordpress.org
Wed Dec 21 16:26:18 UTC 2016


#39358: Media search speed has been dramatically reduced
--------------------------+------------------------------
 Reporter:  merts         |       Owner:  joemcgill
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.7
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |     Focuses:
--------------------------+------------------------------
Changes (by joemcgill):

 * keywords:   => 2nd-opinion
 * owner:   => joemcgill
 * status:  new => reviewing


Comment:

 Hi @merts,

 Welcome to Trac. As @swissspidy noted, this change was an intentional one
 in order to allow people to search for media in the media library by file
 name. I noted performance concerns in comments on #22744, which is
 partially why this change was applied narrowly to only times when
 attachments are being search specifically. Adding this change as a filter
 also gives sites the ability to disable this change by removing the filter
 after it has been added.

 Here's one approach to disabling the filter if you so choose:

 {{{
 add_action( 'pre_get_posts', 'remove_query_attachment_filename_filter' );

 function remove_query_attachment_filename_filter() {
         remove_filter( 'posts_clauses',
 '_filter_query_attachment_filenames' );
 }
 }}}

 We also might need to experiment with adding an index for post meta that
 targets the `_wp_attached_file` key as a way of reducing the query
 performance concerns. I'd appreciate insight from @dd32 or @pento on
 possibilities there.

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


More information about the wp-trac mailing list