Skip to content

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

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

feat(labrinth): Add support for dependencies in search#5385
IThundxr wants to merge 10 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 on lines +624 to +632
let records = sqlx::query!(
"
SELECT d.mod_dependency_id as \"mod_dependency_id: DBProjectId\", d.dependency_type, m.slug as \"slug\" FROM dependencies d
INNER JOIN mods m ON m.id = d.mod_dependency_id
WHERE dependent_id = $1",
version_id.0
)
.fetch_all(pool)
.await?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This query should be batched like the queries above it instead of running for every single version.

This doesn't account for version dependencies.

Would exclude embedded dependencies, at least for now, since it could drastically increase document size for modpacks which might have performance implications.

Comment on lines +643 to +649
if let Some(id) = r.mod_dependency_id {
v.push(crate::models::ids::ProjectId::from(id).to_string())
}

if let Some(slug) = &r.slug {
v.push(slug.to_string())
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't love including both the slug and project ID, would include only the ID.

The item type should be something like below instead of an either-id-or-slug string:

struct Dependency {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    version: Option<Id>,
    project: Id,
}

Comment on lines +303 to +306
pub required_dependencies: Vec<String>,
pub optional_dependencies: Vec<String>,
pub embedded_dependencies: Vec<String>,
pub incompatibilities: Vec<String>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#[serde(default, skip_serializing_if = "Vec::is_empty")]

Comment on lines +257 to +260
pub required_dependencies: Vec<String>,
pub optional_dependencies: Vec<String>,
pub embedded_dependencies: Vec<String>,
pub incompatibilities: Vec<String>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#[serde(default, skip_serializing_if = "Vec::is_empty")]

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