Media Library search not working
Hi! When the Solr plugin is activated on our site, the Media Library search does not work in the "Grid" view. It does work for list view. This site is on a multisite network.
I don't have any more info at this time. I will be doing some digging on my end and will report back.
But am wondering if you are aware of this issue or have seen it on other environments.
Thanks!
On the "grid" view for the Media Library in the admin (/wp-admin/upload.php?search=test), it is performating a JavaScript AJAX request to run the search.
The request goes to /wp-admin/admin-ajax.php. Here is the payload for a search of "test":
action: query-attachments post_id: 0 query[orderby]: date query[s]: test query[order]: DESC query[posts_per_page]: 80 query[paged]: 1
The AJAX function being run is wp_ajax_query_attachments() which you can find here: https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/ajax-actions.php#L2951
When I dig into the WP Query, here are the vars:
s: test
orderby: date
order: DESC
posts_per_page: 80
paged: 1
post_type: attachment
post_status: inherit,private
If I comment out the following filter, the search works. So I'm digging into this function.
https://github.com/pantheon-systems/solr-power/blob/master/includes/class-solrpower-wp-query.php#L132
Here is all the info being passed to $search = SolrPower_Api::get_instance()->query( $qry, $offset, $count, $fq, $sortby, $order, $fields, $extra ); at https://github.com/pantheon-systems/solr-power/blob/master/includes/class-solrpower-wp-query.php#L226
$qry: test AND(post_type:attachment)AND(post_status:inherit,private)
$offset: 0
$count: 80
$fq: empty array
$sortby: post_date
$order: desc
$fields: empty
$extra: empty array
I couldn't figure out the issue so for now I'm disabling Solr on the 'query-attachments' AJAX request.