hiqdev / asset-packagist

Asset Packagist
https://asset-packagist.org
BSD 3-Clause "New" or "Revised" License
247 stars 24 forks source link

Improve search #36

Closed edgardmessias closed 7 years ago

edgardmessias commented 7 years ago

Rework the search page to show multiple packages by search.

For bower, use the search method in BowerRepository For npm, implement npms in NpmRegistry

For search field, we can use Buttons with dropdowns, but using the selec field instead of the button.

edgardmessias commented 7 years ago

@hiqsol , we can use the https://libraries.io/api

Can you check the permission to use?

hiqsol commented 7 years ago

I just tried a couple of searches... Did you try? Do you find it suitable? I didn't find a way to limit package search to npm/bower. I tried search like q='npm moment' and it gives not really useful results :-/

What do you mean about permissions?

edgardmessias commented 7 years ago

In https://libraries.io/api, you can filter by Bower or NPM using &platforms=<value>

Ex.: Only Bower: https://libraries.io/api/search?q=moment&platforms=Bower Ex.: Only NPM: https://libraries.io/api/search?q=moment&platforms=NPM Ex.: Only Bower and NPM: https://libraries.io/api/search?q=moment&platforms=Bower,NPM Note: Remove /api to show site.

For sort, add &sort=<value>, you can sort by relevance(blank value), rank, stars, dependents_count, dependent_repos_count, latest_release_published_at, contributions_count and created_at

We can implement the \yii\data\BaseDataProvider using guzzle

For platforms: https://github.com/librariesio/libraries.io/blob/master/app/controllers/application_controller.rb#L75 For sort: https://github.com/librariesio/libraries.io/blob/master/app/controllers/search_controller.rb#L26

edgardmessias commented 7 years ago

About permission, if the libraries.io allows us to use in the asset-packagist, with a higher rate limit

Current rate limit is 60/request/minute

hiqsol commented 7 years ago

Cool about platform filter :) Didn't see it in their doc. With this feature it looks quite nice to use.

According to the current usage of asset-packagist.org — 60 requests per minute is more then enough :)

If you're about to implement it please consider yii2-hiart, we've developped this library and use it for api interactions very successfully.

edgardmessias commented 7 years ago

I'll start as soon as possible.

hiqsol commented 7 years ago

Cool! Thank you!

edgardmessias commented 7 years ago

@hiqsol, I done without using yii2-hiart.

I tried with yii2-hiart, but the DataProvider part needs to improve a lot.