Skip to content

Commit

Permalink
did this solve the compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed May 6, 2024
1 parent b52c079 commit b12a619
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
25 changes: 20 additions & 5 deletions server/main-api/src/search/search_executor/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use meilisearch_sdk::indexes::Index;
use meilisearch_sdk::search::{MultiSearchResponse, SearchQuery, Selectors};
use serde::Deserialize;

use crate::search::SanitisedSearchQueryArgs;
use crate::search::search_executor::parser::{Filter, ParsedQuery, TextToken};
use crate::search::SanitisedSearchQueryArgs;

#[derive(Deserialize, Default, Clone, Debug)]
#[allow(dead_code)]
Expand Down Expand Up @@ -129,7 +129,10 @@ impl GeoEntryQuery {
.join(" ")
}

fn common_query<'b: 'a, 'a>(&'b self, entries: &'a Index) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
fn common_query<'b: 'a, 'a>(
&'b self,
entries: &'a Index,
) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
SearchQuery::new(entries)
.with_facets(Selectors::Some(&["facet"]))
.with_highlight_pre_tag(&self.highlighting.0)
Expand All @@ -138,7 +141,11 @@ impl GeoEntryQuery {
.build()
}

fn merged_query<'a>(&'a self, entries: &'a Index, query: &'a str) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
fn merged_query<'a>(
&'a self,
entries: &'a Index,
query: &'a str,
) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
let mut s = self
.common_query(entries)
.with_query(query)
Expand All @@ -150,15 +157,23 @@ impl GeoEntryQuery {
s
}

fn buildings_query<'a>(&'a self, entries: &'a Index, query: &'a str) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
fn buildings_query<'a>(
&'a self,
entries: &'a Index,
query: &'a str,
) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
self.common_query(entries)
.with_query(query)
.with_limit(2 * self.args.limit_buildings) // we might do reordering later
.with_filter(&self.filters.buildings)
.build()
}

fn rooms_query<'a>(&'a self, entries: &'a Index, query: &'a str) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
fn rooms_query<'a>(
&'a self,
entries: &'a Index,
query: &'a str,
) -> SearchQuery<'a, meilisearch_sdk::DefaultHttpClient> {
self.common_query(entries)
.with_query(query)
.with_limit(self.args.limit_rooms)
Expand Down
9 changes: 5 additions & 4 deletions server/main-api/src/setup/meilisearch.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::collections::HashMap;
use std::time::Duration;

use log::{error, info};
use meilisearch_sdk::client::Client;
use meilisearch_sdk::settings::Settings;
use meilisearch_sdk::tasks::Task;
use meilisearch_sdk::Client;
use serde_json::Value;
use std::collections::HashMap;
use std::time::Duration;

const TIMEOUT: Option<Duration> = Some(Duration::from_secs(20));
const POLLING_RATE: Option<Duration> = Some(Duration::from_millis(50));
Expand Down Expand Up @@ -48,7 +49,7 @@ pub(crate) async fn setup_meilisearch() -> Result<(), crate::BoxedError> {
let start = std::time::Instant::now();
let ms_url = std::env::var("MIELI_URL").unwrap_or_else(|_| "http://localhost:7700".to_string());
info!("connecting to Meilisearch at {ms_url}", ms_url = ms_url);
let client = Client::new(ms_url, std::env::var("MEILI_MASTER_KEY").ok());
let client = Client::new(ms_url, std::env::var("MEILI_MASTER_KEY").ok())?;
info!("waiting for Meilisearch to be healthy");
wait_for_healthy(&client).await;
info!("Meilisearch is healthy");
Expand Down

0 comments on commit b12a619

Please sign in to comment.