From 17d61277fa1cc5c444a7ec4c303966ed2377683b Mon Sep 17 00:00:00 2001 From: Jai A Date: Mon, 30 Dec 2024 20:55:37 -0700 Subject: [PATCH] Bump meilisearch version --- Cargo.lock | 172 ++++++----------------- apps/labrinth/Cargo.toml | 2 +- apps/labrinth/src/search/indexing/mod.rs | 11 +- apps/labrinth/src/search/mod.rs | 6 +- docker-compose.yml | 2 +- 5 files changed, 55 insertions(+), 138 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c092ebe67..8dffdfd5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,7 +550,7 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.7.3", + "polling", "rustix", "slab", "tracing", @@ -1170,12 +1170,6 @@ dependencies = [ "toml 0.8.19", ] -[[package]] -name = "castaway" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" - [[package]] name = "cc" version = "1.1.22" @@ -1809,37 +1803,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "curl" -version = "0.4.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265" -dependencies = [ - "curl-sys", - "libc", - "openssl-probe", - "openssl-sys", - "schannel", - "socket2", - "windows-sys 0.52.0", -] - -[[package]] -name = "curl-sys" -version = "0.4.77+curl-8.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480" -dependencies = [ - "cc", - "libc", - "libnghttp2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", - "windows-sys 0.52.0", -] - [[package]] name = "daedalus" version = "0.2.3" @@ -3040,8 +3003,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -4016,33 +3981,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "isahc" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "334e04b4d781f436dc315cb1e7515bd96826426345d498149e4bde36b67f8ee9" -dependencies = [ - "async-channel 1.9.0", - "castaway", - "crossbeam-utils 0.8.20", - "curl", - "curl-sys", - "encoding_rs", - "event-listener 2.5.3", - "futures-lite 1.13.0", - "http 0.2.12", - "log", - "mime", - "once_cell", - "polling 2.8.0", - "slab", - "sluice", - "tracing", - "tracing-futures", - "url", - "waker-fn", -] - [[package]] name = "iso8601" version = "0.6.1" @@ -4216,12 +4154,13 @@ dependencies = [ [[package]] name = "jsonwebtoken" -version = "8.3.0" +version = "9.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" dependencies = [ "base64 0.21.7", - "ring 0.16.20", + "js-sys", + "ring 0.17.8", "serde", "serde_json", ] @@ -4464,16 +4403,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libnghttp2-sys" -version = "0.1.10+1.61.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "959c25552127d2e1fa72f0e52548ec04fc386e827ba71a7bd01db46a447dc135" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "libredox" version = "0.1.3" @@ -4506,18 +4435,6 @@ dependencies = [ "glob", ] -[[package]] -name = "libz-sys" -version = "1.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -4708,38 +4625,39 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "meilisearch-index-setting-macro" -version = "0.24.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f2124b55b9cb28e6a08b28854f4e834a51333cbdc2f72935f401efa686c13c" +checksum = "056e8c0652af81cc6525e0d9c0e1037ea7bcd77955dcd4aef1a1441be7ad7e55" dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 1.0.109", + "structmeta", + "syn 2.0.90", ] [[package]] name = "meilisearch-sdk" -version = "0.24.3" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2257ea8ed24b079c21570f473e58cccc3de23b46cee331fc513fccdc3f1ae5a1" +checksum = "66958255878d712b4f2dece377a8661b41dc976ff15f564b91bfce8b4a619304" dependencies = [ "async-trait", + "bytes 1.7.2", "either", "futures 0.3.30", "futures-io", - "isahc", "iso8601", - "js-sys", "jsonwebtoken", "log", "meilisearch-index-setting-macro", + "pin-project-lite", + "reqwest 0.12.7", "serde", "serde_json", "thiserror 1.0.64", "time", "uuid 1.10.0", - "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "yaup", @@ -6022,22 +5940,6 @@ dependencies = [ "miniz_oxide 0.8.0", ] -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if 1.0.0", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "polling" version = "3.7.3" @@ -7808,17 +7710,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "sluice" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7400c0eff44aa2fcb5e31a5f24ba9716ed90138769e4977a2ba6014ae63eb5" -dependencies = [ - "async-channel 1.9.0", - "futures-core", - "futures-io", -] - [[package]] name = "smallvec" version = "0.6.14" @@ -8263,6 +8154,29 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "structmeta" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1575d8d40908d70f6fd05537266b90ae71b15dbbe7a8b7dffa2b759306d329" +dependencies = [ + "proc-macro2", + "quote", + "structmeta-derive", + "syn 2.0.90", +] + +[[package]] +name = "structmeta-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "strum" version = "0.26.3" @@ -9912,6 +9826,7 @@ dependencies = [ "getrandom 0.2.15", "rand 0.8.5", "serde", + "wasm-bindgen", ] [[package]] @@ -11008,12 +10923,13 @@ dependencies = [ [[package]] name = "yaup" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a59e7d27bed43f7c37c25df5192ea9d435a8092a902e02203359ac9ce3e429d9" +checksum = "b0144f1a16a199846cb21024da74edd930b43443463292f536b7110b4855b5c6" dependencies = [ + "form_urlencoded", "serde", - "url", + "thiserror 1.0.64", ] [[package]] diff --git a/apps/labrinth/Cargo.toml b/apps/labrinth/Cargo.toml index 3f0b2a6d2..376045a0a 100644 --- a/apps/labrinth/Cargo.toml +++ b/apps/labrinth/Cargo.toml @@ -30,7 +30,7 @@ async-trait = "0.1.70" dashmap = "5.4.0" lazy_static = "1.4.0" -meilisearch-sdk = "0.24.3" +meilisearch-sdk = "0.27.1" rust-s3 = "0.33.0" reqwest = { version = "0.11.18", features = ["json", "multipart"] } hyper = { version = "0.14", features = ["full"] } diff --git a/apps/labrinth/src/search/indexing/mod.rs b/apps/labrinth/src/search/indexing/mod.rs index 679473038..0c5648530 100644 --- a/apps/labrinth/src/search/indexing/mod.rs +++ b/apps/labrinth/src/search/indexing/mod.rs @@ -6,10 +6,9 @@ use crate::models::ids::base62_impl::to_base62; use crate::search::{SearchConfig, UploadSearchProject}; use local_import::index_local; use log::info; -use meilisearch_sdk::client::Client; +use meilisearch_sdk::client::{Client, SwapIndexes}; use meilisearch_sdk::indexes::Index; use meilisearch_sdk::settings::{PaginationSetting, Settings}; -use meilisearch_sdk::SwapIndexes; use sqlx::postgres::PgPool; use thiserror::Error; #[derive(Error, Debug)] @@ -100,7 +99,7 @@ pub async fn swap_index( config: &SearchConfig, index_name: &str, ) -> Result<(), IndexingError> { - let client = config.make_client(); + let client = config.make_client()?; let index_name_next = config.get_index_name(index_name, true); let index_name = config.get_index_name(index_name, false); let swap_indices = SwapIndexes { @@ -119,7 +118,7 @@ pub async fn get_indexes_for_indexing( config: &SearchConfig, next: bool, // Get the 'next' one ) -> Result, meilisearch_sdk::errors::Error> { - let client = config.make_client(); + let client = config.make_client()?; let project_name = config.get_index_name("projects", next); let project_filtered_name = config.get_index_name("projects_filtered", next); @@ -285,7 +284,7 @@ pub async fn add_projects( additional_fields: Vec, config: &SearchConfig, ) -> Result<(), IndexingError> { - let client = config.make_client(); + let client = config.make_client()?; for index in indices { update_and_add_to_index(&client, index, &projects, &additional_fields) .await?; @@ -296,7 +295,7 @@ pub async fn add_projects( fn default_settings() -> Settings { Settings::new() - .with_distinct_attribute("project_id") + .with_distinct_attribute(Some("project_id")) .with_displayed_attributes(DEFAULT_DISPLAYED_ATTRIBUTES) .with_searchable_attributes(DEFAULT_SEARCHABLE_ATTRIBUTES) .with_sortable_attributes(DEFAULT_SORTABLE_ATTRIBUTES) diff --git a/apps/labrinth/src/search/mod.rs b/apps/labrinth/src/search/mod.rs index 244928f25..a6e07ef54 100644 --- a/apps/labrinth/src/search/mod.rs +++ b/apps/labrinth/src/search/mod.rs @@ -80,7 +80,9 @@ impl SearchConfig { } } - pub fn make_client(&self) -> Client { + pub fn make_client( + &self, + ) -> Result { Client::new(self.address.as_str(), Some(self.key.as_str())) } @@ -190,7 +192,7 @@ pub async fn search_for_project( info: &SearchRequest, config: &SearchConfig, ) -> Result { - let client = Client::new(&*config.address, Some(&*config.key)); + let client = Client::new(&*config.address, Some(&*config.key))?; let offset: usize = info.offset.as_deref().unwrap_or("0").parse()?; let index = info.index.as_deref().unwrap_or("relevance"); diff --git a/docker-compose.yml b/docker-compose.yml index 49aeafb0d..74baebc76 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: POSTGRES_PASSWORD: labrinth POSTGRES_HOST_AUTH_METHOD: trust meilisearch: - image: getmeili/meilisearch:v1.5.0 + image: getmeili/meilisearch:v1.12.0 restart: on-failure ports: - '7700:7700'