Skip to content

feat(labrinth): Add support for dependencies in search#5385

Open
IThundxr wants to merge 13 commits intomodrinth:mainfrom
IThundxr:dependents-search
Open

feat(labrinth): Add support for dependencies in search#5385
IThundxr wants to merge 13 commits intomodrinth:mainfrom
IThundxr:dependents-search

Conversation

@IThundxr
Copy link
Copy Markdown
Contributor

@IThundxr IThundxr commented Feb 17, 2026

Adds dependencies to the projects index in meilisearch, this will allow you to search for mods depending on a specific mod. This is a continuation of #4105.

This currently does not include support for searching dependencies in the frontend, some work has been done here but i'm not entirely sure how this should be laid out and look like, i think it'll be better for the team to work on implementing that instead.

@IThundxr IThundxr marked this pull request as draft February 17, 2026 00:21
@IThundxr IThundxr changed the title feat(labrinth): Add support for dependencies in search feat: Add support for dependencies in search Feb 17, 2026
@IThundxr IThundxr changed the title feat: Add support for dependencies in search feat(labrinth): Add support for dependencies in search Feb 17, 2026
@IThundxr IThundxr marked this pull request as ready for review February 17, 2026 01:40
@IThundxr IThundxr changed the title feat(labrinth): Add support for dependencies in search feat: Add support for dependencies in search Feb 17, 2026
@IThundxr IThundxr marked this pull request as draft February 17, 2026 01:48
@IThundxr IThundxr marked this pull request as ready for review February 17, 2026 02:42
@IThundxr IThundxr changed the title feat: Add support for dependencies in search feat(labrinth): Add support for dependencies in search Feb 17, 2026
@IMB11 IMB11 added the 📂 Under review [Triage] Is being reviewed by Modrinth Staff for future roadmap consideration. label Feb 18, 2026
Copy link
Copy Markdown
Member

@Prospector Prospector left a comment

Choose a reason for hiding this comment

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

I would add each dependency type as a separate array, so like required_dependencies, optional_dependencies, incompatibilities, etc.

@IThundxr
Copy link
Copy Markdown
Contributor Author

I would add each dependency type as a separate array, so like required_dependencies, optional_dependencies, incompatibilities, etc.

Went ahead and made it use a map instead, the output of /v3/search looks like the following: https://hst.sh/yaxijigeti.json

@IThundxr
Copy link
Copy Markdown
Contributor Author

Actually, you wouldn't be able to filter those with facets, i'll split them into 3 different arrays

Copy link
Copy Markdown
Contributor

@fetchfern fetchfern left a comment

Choose a reason for hiding this comment

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

Would need to be migrated to typesense since we use it for search now

Comment thread apps/labrinth/src/search/indexing.rs Outdated
Comment thread apps/labrinth/src/search/indexing.rs Outdated
Comment thread apps/labrinth/src/search/mod.rs Outdated
Comment thread apps/labrinth/src/search/mod.rs Outdated
- Add support for elasticsearch and typesense
- New structs for some types
- Add version of dependency to search
- Address reviews
@IThundxr IThundxr force-pushed the dependents-search branch from 1388082 to d7c0f28 Compare April 24, 2026 23:23
@IThundxr
Copy link
Copy Markdown
Contributor Author

IThundxr commented Apr 24, 2026

Addressed the reviews, and made some additional changes:

  • Move dependency lists into their own struct, and create a struct for dependencies which contains the project id and if available the version id
  • Formatted dependency as project[:version] in the returned search data (a wildcard can be used in the facet to get all mods that depend on a specific mod, rather than a specific version of a mod), Examples:
    • [["required_dependencies:97h8UxBq*"]] for anything depending on project 97h8UxBq
    • [["required_dependencies:97h8UxBq:grWk3nFR"]] for anything depending on version grWk3nFR from project 97h8UxBq
  • Instead of adding to vecs based off type strings, it now uses the enum, had to adjust the DependencyType struct a bit so sqlx would automatically convert the type in the query
  • Documented the query, and added a little explainer on what each returned column represents as the names feel a bit confusing

A question i have about the db schema is: dependencies.mod_dependency_id is marked as nullable, but are there any cases in which it'd actually be null? Would be nice if someone could the query below to check, as if it's never going to be null, it would be better to create a migration for that and remove the null checking that is currently needed for it.
SELECT COUNT(*) FROM dependencies WHERE mod_dependency_id IS NULL;

@IThundxr IThundxr force-pushed the dependents-search branch from 70329fd to a1181c9 Compare April 25, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📂 Under review [Triage] Is being reviewed by Modrinth Staff for future roadmap consideration.

Development

Successfully merging this pull request may close these issues.

4 participants