wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.64k stars 1.1k forks source link

Plugin Search Results are not consistent #16486

Open eduardozulian opened 3 years ago

eduardozulian commented 3 years ago

Expected behavior

To find relevant plugins even if only part of the title is typed.

Actual behavior

Steps to reproduce the behavior

  1. Go to My Site > Plugins
  2. Tap the search field
  3. Search for akism. Result: no plugins found
  4. Search for akime. Result: one plugin called Never Loose Contact Form
  5. Search for buddyp or buddypr. Result: no plugins found
Tested on iPhone, iOS 14.4, WPiOS 17.2
aerych commented 2 years ago

I took a closer look at this one today.

I started by testing the https://wordpress.org/plugins/ search feature to see what the web would return. The results match what I see inside the app from the same search term. For due diligence I tried querying the endpoint used by the app (https://api.wordpress.org/plugins/info/1.1/) directly and had the same results.

The endpoint has sparse documentation, but there is some at https://codex.wordpress.org/WordPress.org_API, which references two other sites: http://dd32.id.au/projects/wordpressorg-plugin-information-api-docs/ and https://orbisius.com/blog/use-wordpress-org-api-search-plugins-themes-p4477. From my read of the info there the query the apps are making is what we'd expect to do. There doesn't seem to be any good alternative for a keyword search beyond this at least for this endpoint.

If we want to improve the quality of search results, it would probably require an update to the endpoint code.

So naturally I went hunting for the endpoint code, and while I didn't find it I did find something similar. There is a core REST API version of this endpoint located at https://wordpress.org/plugins/wp-json/plugins/v1/query-plugins. Passing s=keyword as a query returns better results than the endpoint currently used by the apps. However, only the names of matching plugins are returned. To get plugin details an additional query must be made to https://wordpress.org/plugins/wp-json/plugins/v1/plugin/[slug] for each individual result. What looks like the code for these endpoints can be found at:

Switching to these endpoints could provide a better experience but at a quick glance this looks like a sizable project and out of scope for groundskeeping.

Would it make sense to close this issue and open a new feature request to switch to the new endpoints?