Making WordPress.org

Opened 5 years ago

Last modified 5 years ago

#4253 accepted defect (bug)

Plugins API `query_plugins` produces wrong number of results

Reported by: schlessera's profile schlessera Owned by: tellyworth's profile tellyworth
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

The per_page argument for the Plugins API query_plugins action seems to return the wrong number of results in some cases.

So, if you limit the per_page to 20, you only get 19 items back event though that there are more than 20 results available.

We are hitting this issue with the WP-CLI plugin search command, which shows the exact count of elements returned. See https://github.com/wp-cli/extension-command/issues/156 for the related issue.

Change History (5)

#1 @Otto42
5 years ago

This appears to be because one of the results in that particular search query is a closed plugin. It shouldn't be appearing at all in the results, one would think.

The API filters it out thus creating the wrong count. Not sure why it comes back in the search results in the first place though.

#2 @dd32
5 years ago

I think I'm okay with the API returning less than the paged amount of results as a whole, but reducing those cases is certainly worthwhile.

Currently none of the post statuses are marked as excluded from search, so doing that might help (patch not needed)

Looking at the ElasticSearch search & result though, it doesn't reference the post_status field anywhere, but upon looking into it, the disabled plugin is showing as "post_status": "publish", within Elastic Search, so it could just be an ingestion bug.

#3 @dd32
5 years ago

  • Component changed from API to Plugin Directory

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


5 years ago

#5 @tellyworth
5 years ago

  • Owner set to tellyworth
  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.