Skip to content

Commit d7c0f28

Browse files
committed
Update dependencies in search
- Add support for elasticsearch and typesense - New structs for some types - Add version of dependency to search - Address reviews
1 parent 9f5a011 commit d7c0f28

13 files changed

Lines changed: 280 additions & 193 deletions

apps/labrinth/.sqlx/query-0f3d943e4fc48a94363b77c8a7d36eb1dd626e77331d8278c406df952691be4c.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

apps/labrinth/.sqlx/query-20cff8fdf7971e91c9d473b9a4663ce02ca16781e32232ae0fa7a0af1973d3a4.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/labrinth/.sqlx/query-6678cd4c51771cfaae2be8021ba66908ea41a06ba858dc5b523aef6aae27b850.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

apps/labrinth/.sqlx/query-69a1cb4b7f1115a990d1fc4805d58541fc78e910111c09ba3d50a12d9ca4a9f8.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/labrinth/.sqlx/query-823776dbfefe3061b88492f5cba8ae2a58e3b8ff46a1e29b7f4a57bf68f8da84.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

apps/labrinth/.sqlx/query-eae9030e35687c348c2aa9e7363ed2a23b88bae6b06c218849fc4063625b5f58.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-fd5c773a61d35bcd71503ec4d5f86e8917cfab9679d5064074681663ba467e41.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

apps/labrinth/src/models/v3/projects.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,9 @@ impl VersionType {
928928
}
929929

930930
#[derive(
931-
Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Eq, utoipa::ToSchema,
931+
Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Eq, sqlx::Type, utoipa::ToSchema,
932932
)]
933+
#[sqlx(type_name = "varchar", rename_all = "lowercase")]
933934
#[serde(rename_all = "lowercase")]
934935
pub enum DependencyType {
935936
Required,

apps/labrinth/src/search/backend/elasticsearch/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ impl SearchField {
163163
path: "open_source",
164164
mapping: json!({ "type": "boolean" }),
165165
},
166+
SearchField::RequiredDependencies => ElasticsearchFieldSpec {
167+
path: "required_dependencies",
168+
mapping: json!({ "type": "keyword" }),
169+
},
170+
SearchField::OptionalDependencies => ElasticsearchFieldSpec {
171+
path: "optional_dependencies",
172+
mapping: json!({ "type": "keyword" }),
173+
},
174+
SearchField::Incompatibilities => ElasticsearchFieldSpec {
175+
path: "incompatibilities",
176+
mapping: json!({ "type": "keyword" }),
177+
},
166178
SearchField::Environment => ElasticsearchFieldSpec {
167179
path: "environment",
168180
mapping: json!({ "type": "keyword" }),
@@ -251,6 +263,9 @@ static ELASTICSEARCH_PROPERTIES: LazyLock<serde_json::Map<String, Value>> =
251263
("license".to_string(), json!({ "type": "keyword" })),
252264
("loaders".to_string(), json!({ "type": "keyword" })),
253265
("color".to_string(), json!({ "type": "long" })),
266+
("required_dependencies".to_string(), json!({ "type": "keyword" })),
267+
("optional_dependencies".to_string(), json!({ "type": "keyword" })),
268+
("incompatibilities".to_string(), json!({ "type": "keyword" })),
254269
("environment".to_string(), json!({ "type": "keyword" })),
255270
("mrpack_loaders".to_string(), json!({ "type": "keyword" })),
256271
(

apps/labrinth/src/search/backend/meilisearch/indexing.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,18 @@ impl SearchField {
581581
path: "open_source",
582582
filterable: true,
583583
},
584+
SearchField::RequiredDependencies => MeilisearchFieldSpec {
585+
path: "required_dependencies",
586+
filterable: true,
587+
},
588+
SearchField::OptionalDependencies => MeilisearchFieldSpec {
589+
path: "optional_dependencies",
590+
filterable: true,
591+
},
592+
SearchField::Incompatibilities => MeilisearchFieldSpec {
593+
path: "incompatibilities",
594+
filterable: true,
595+
},
584596
SearchField::Environment => MeilisearchFieldSpec {
585597
path: "environment",
586598
filterable: true,
@@ -659,7 +671,6 @@ const DEFAULT_DISPLAYED_ATTRIBUTES: &[&str] = &[
659671
"color",
660672
"required_dependencies",
661673
"optional_dependencies",
662-
"embedded_dependencies",
663674
"incompatibilities",
664675
// Note: loader fields are not here, but are added on as they are needed (so they can be dynamically added depending on which exist).
665676
// TODO: remove these- as they should be automatically populated. This is a band-aid fix.
@@ -702,7 +713,6 @@ const DEFAULT_SORTABLE_ATTRIBUTES: &[&str] = &[
702713
"version_published_timestamp",
703714
"required_dependencies",
704715
"optional_dependencies",
705-
"embedded_dependencies",
706716
"incompatibilities",
707717
"minecraft_java_server.verified_plays_2w",
708718
"minecraft_java_server.ping.data.players_online",

0 commit comments

Comments
 (0)