Skip to content

Commit

Permalink
Bump meilisearch version
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Dec 31, 2024
1 parent bb3de4b commit 17d6127
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 138 deletions.
172 changes: 44 additions & 128 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/labrinth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
11 changes: 5 additions & 6 deletions apps/labrinth/src/search/indexing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand All @@ -119,7 +118,7 @@ pub async fn get_indexes_for_indexing(
config: &SearchConfig,
next: bool, // Get the 'next' one
) -> Result<Vec<Index>, 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);
Expand Down Expand Up @@ -285,7 +284,7 @@ pub async fn add_projects(
additional_fields: Vec<String>,
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?;
Expand All @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions apps/labrinth/src/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ impl SearchConfig {
}
}

pub fn make_client(&self) -> Client {
pub fn make_client(
&self,
) -> Result<Client, meilisearch_sdk::errors::Error> {
Client::new(self.address.as_str(), Some(self.key.as_str()))
}

Expand Down Expand Up @@ -190,7 +192,7 @@ pub async fn search_for_project(
info: &SearchRequest,
config: &SearchConfig,
) -> Result<SearchResults, SearchError> {
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");
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 17d6127

Please sign in to comment.