pixqc / ziglist

Discover Zig projects and packages
https://ziglist.org
MIT License
44 stars 0 forks source link

Dependency count seems inaccurate sometimes #3

Closed natecraddock closed 2 months ago

natecraddock commented 2 months ago

Wonderful index of Zig projects, thank you for the work! It is very well designed.

image

Just wanted to point out that the dependency count seems to be off. When I go to the dependencies page it correctly lists the 6 deps in the zon file, but the home/index page says +61 more which I find interesting.

image

And this project only has a dep on vaxis but it is listed 5 times, with 7 more hidden.

Maybe whatever is indexing is adding to the deps list rather than replacing it?

pixqc commented 2 months ago

Yeah there was a bug on /search that listed duplicate dependencies. Could you give it another go? It looks good on me now.

image
natecraddock commented 2 months ago

Wow you're fast!

I'm still seeing some duplicates. Fewer than before though

image
pixqc commented 2 months ago

Okay I think I've repro'd it locally. My hunch says something's wrong with the select query

image
pixqc commented 2 months ago

The issue is because SQLite's full text search virtual table doesn't enforce unique constraint, and the previous code just inserted dupes into the table. That's why the dupe only shows on search, but not on dependencies.

Should be fixed on: https://github.com/pixqc/ziglist/commit/cd5c51abea02ca34c97404eae63fc7c58a761ae1

I've tried intentionally inserted two ziglang/zig to the virtual table on prod and there are no dupes.

image

Pretty sure the issue is fixed, but please re-open if you still see the dupes again!

natecraddock commented 2 months ago

🙌 looks perfect! Wonderful fast fix