Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media Library search not working #537

Open
bamadesigner opened this issue Jun 28, 2022 · 6 comments
Open

Media Library search not working #537

bamadesigner opened this issue Jun 28, 2022 · 6 comments

Comments

@bamadesigner
Copy link
Contributor

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!

@bamadesigner
Copy link
Contributor Author

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

@bamadesigner
Copy link
Contributor Author

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

@bamadesigner
Copy link
Contributor Author

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

@bamadesigner
Copy link
Contributor Author

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

@bamadesigner
Copy link
Contributor Author

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

@bamadesigner
Copy link
Contributor Author

I couldn't figure out the issue so for now I'm disabling Solr on the 'query-attachments' AJAX request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant