Skip to content

Build tool search - #1304

Closed
PragTob wants to merge 2 commits into
hexpm:mainfrom
PragTob:build-tool-search
Closed

PragTob wants to merge 2 commits into
hexpm:mainfrom
PragTob:build-tool-search

Conversation

@PragTob

@PragTob PragTob commented May 6, 2025

Copy link
Copy Markdown
Contributor

Basic implementation of searching for package by build tool.

Fixes #1300

I think adding an index on build tool is still a worthwhile
discussion, although I'm unsure because we're already filtering
by package_id so I don't think just an index on that field would be very effective - but maybe a combined index is worth the overhead.
Naturally, I'd love to write a benchmark but oh well 👀

This is done by the first commit ad9f838

There's a second commit (606e727) that introduces a test helper which I think is very useful but can also be removed/moved to another PR.

Thank you for hex 💚 Also, happy for any feedback on code etc. :)

@PragTob PragTob mentioned this pull request May 6, 2025
@PragTob

PragTob commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

I'd still like to discuss the need for an index - I could add benchee and try to write a benchmark but due to the data setup required that may be quite extensive 😅

@PragTob

PragTob commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

Tests are failing due the good old retired runner... gimme a sec (hopefully)

@PragTob

PragTob commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

Before the impersonation reports start rolling in...

IMG_20180120_094003_Bokeh-ANIMATION

@lpil

lpil commented May 7, 2025 •

Copy link
Copy Markdown
Contributor

Amazing! Thank you @PragTob !!

RE an index: my thought is that there's not many releases per package, so perhaps it's not so impactful. It or some other optimisation could be a later addition if it is discovered in production that better performance is desired.

PragTob added 2 commits May 8, 2025 10:20
Basic implementation of searching for package by build tool.

Fixes hexpm#1300

I think adding an index on build tool is still a worthwhile
discussion, although I'm unsure because we're already filtering
by package_id - but maybe a combined index is worth the overhead.
Naturally, I'd love to write a benchmark but oh well 👀
I'm quite fond of little test helpers, I think it helps the
tests focus on the essentials by taking a lot of unnecessary
noise/arguments out of the way - so they make reading and writing
nicer :)
@PragTob
PragTob force-pushed the build-tool-search branch from 606e727 to 69561d3 Compare May 8, 2025 08:20
@PragTob

PragTob commented May 8, 2025

Copy link
Copy Markdown
Contributor Author

(rebased against main to pick up the CI changes so that CI can pass fully hopefully)

@lpil

lpil commented Jun 2, 2025

Copy link
Copy Markdown
Contributor

Hello @wojtekmach! Please excuse my tagging you 🙏

We're looking to add a new feature to the Gleam package search site and whether or not the Hex API has this feature dictates how we will implement it. Is this contribution likely to be accepted? We're also happy to help with anything that needs refining here also.

Thank you again!

@wojtekmach

Copy link
Copy Markdown
Member

No worries, thanks for the ping, we're keen on moving forward with this.

@lpil

lpil commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Great, thank you!

@PragTob

PragTob commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

👋

Speaking of which, anything I can do to move forward with this? 👀

Do bunny pictures help?

IMG_20171227_094933_Bokeh

No? How about bunny gifs?

IMG_20180302_120240-ANIMATION

Just joking, take your time I know the pressure of OSS maintainers all too well. Also, I know wrong city, but I'll be in Warsaw this extended weekend!

@wojtekmach

Copy link
Copy Markdown
Member

I think it'd be nice to have a conclusion whether an index would be useful for this. We have 21k packages total and 203k releases total, could you try with some synthetic data? If it'd be useful I could send you a prod dump of public packages and releases tables.

@PragTob

PragTob commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

@wojtekmach you're asking ME to BENCHMARK something?

intensity

I can't promise any time line, sadly the reason for my visit in Warsaw isn't too happy overall and so I'll be busy the next 2 weeks.

Thanks for the feedback that the feature itself is wanted and a benchmark would be helpful, that way I know it's worth investing the time 🎉

@ericmj ericmj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but after checking with EXPLAIN I think we need the index, it changes the query from 150ms -> 20ms.

So lets go with something like: CREATE INDEX releases_meta_build_tools_idx ON releases USING GIN ((meta->'build_tools'));

@PragTob

PragTob commented Aug 6, 2025

Copy link
Copy Markdown
Contributor Author

Hey @ericmj thank you very much. I shall do that, maybe this weekend. I'd still like to do the benchmark. My time has been limited (new job, and most recently a close friend passed) so no promises as usual.

@lpil

lpil commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

Hello folks! Would it be useful for one of the Gleam peeps to add this last index?

@ericmj

ericmj commented Sep 15, 2025

Copy link
Copy Markdown
Member

@lpil Yes, please go ahead.

@kwando

kwando commented Sep 19, 2025 •

Copy link
Copy Markdown
Contributor

Currently this breaks when using build_tools:mix in the search field. We need to add as: :package in a few places for this to work. (The Package.count query blows up otherwise).
Edit: Just one place

@kwando

kwando commented Sep 19, 2025

Copy link
Copy Markdown
Contributor

I have added the suggested index, added a test case for the package_controller and fixed the remaining problem in a PR to this PR. Let me know if there is something I should do differently.

@kwando kwando mentioned this pull request Sep 21, 2025
@PragTob

PragTob commented Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

👋

Just came around to have a look at this again. Thanks @kwando

Sorry for the inactivity, losing Piotr and some other stress had a bigger impact on me than I thought at the time. Should be ready for some more action again but it seems that's not needed any more.

I might still add the the benchmark at some point.... for science but that can be done separately and sometimes I go too hard on these things 😅

IMG_20210925_095053_Bokeh

@kwando

kwando commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

@PragTob Glad you are feeling better :) The same changes made are made to your PR-branch in your repo if you wanna bring them into this PR.
Otherwise there is a new one open directly on this repo, but seems like I managed to merge main into that one which might be (or not) a problem depending on how things are done around here.

@lpil

lpil commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

Don't say sorry @PragTob! That's a real tough situation, and we're grateful for your help. Glad you're doing good 💜

@ericmj

ericmj commented Sep 24, 2025

Copy link
Copy Markdown
Member

Closing in favor of #1324.

Thank you @PragTob for starting and @kwando for picking it up! 💜

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

Successfully merging this pull request may close these issues.

API filter by build tool

5 participants