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

Search improvements #10336

Merged
merged 2 commits into from Dec 8, 2021
Merged

Search improvements #10336

merged 2 commits into from Dec 8, 2021

Conversation

Seldaek
Copy link
Member

@Seldaek Seldaek commented Dec 7, 2021

This lays groundwork to be able to further speed up #10320

@Seldaek Seldaek added this to the 2.2 milestone Dec 7, 2021
@Seldaek
Copy link
Member Author

Seldaek commented Dec 7, 2021

@dkarlovi @GromNaN please have a look here :)

@Seldaek Seldaek force-pushed the search branch 4 times, most recently from e0db4ba to 33b71b9 Compare December 7, 2021 20:52
@Seldaek
Copy link
Member Author

Seldaek commented Dec 7, 2021

@GromNaN I added a second commit to hopefully really make the best of the packagist.org API (which may need to be optimized too tbh as it right now does a fairly poor SQL query for vendor search, but once Composer is using it that can be optimized later easily if needed).

@GromNaN
Copy link
Contributor

GromNaN commented Dec 7, 2021

That's impressing that you created a new library in such short time to solve this issues.

Performance improvement is very appreciable. I go from 900ms to 300ms on a --only-names.

BC break? I cannot use regex to match package name (same for vendor):

bin/composer search --only-name ^composer
bin/composer search --only-vendor ^composer

Thanks to the --only-vendor option, we can count 111289 vendors! That's still way too much for completion. Popularity sort would be very useful. That could be by sorting the packages in package-list.txt and vendor-list.txt.

@Seldaek
Copy link
Member Author

Seldaek commented Dec 8, 2021

BC break? I cannot use regex to match package name (same for vendor):

This is intended, the regex leak was before not by design, so I fixed it. You can still use regex at the PHP API level just not at CLI level. So you should be able to search for ^composer with SEARCH_VENDOR mode in #10320 to get the best results.

And yes the amount of vendors is still huge that is true.. I'll need to research how we can improve the sort order on the packagist.org API, but I need to focus on wrapping up Composer 2.2.0 first :)

@Seldaek Seldaek merged commit cc32ebc into composer:main Dec 8, 2021
@Seldaek Seldaek deleted the search branch December 8, 2021 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants