Log warn about using both q and vector field parameters

This commit is contained in:
Clément Renault 2023-06-27 12:31:52 +02:00
parent b2b413db12
commit e69be93e42
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -6,12 +6,13 @@ use std::time::Instant;
use deserr::Deserr; use deserr::Deserr;
use either::Either; use either::Either;
use index_scheduler::RoFeatures; use index_scheduler::RoFeatures;
use log::warn;
use meilisearch_auth::IndexSearchRules; use meilisearch_auth::IndexSearchRules;
use meilisearch_types::deserr::DeserrJsonError; use meilisearch_types::deserr::DeserrJsonError;
use meilisearch_types::error::deserr_codes::*; use meilisearch_types::error::deserr_codes::*;
use meilisearch_types::index_uid::IndexUid; use meilisearch_types::index_uid::IndexUid;
use meilisearch_types::milli::dot_product_similarity;
use meilisearch_types::milli::score_details::{ScoreDetails, ScoringStrategy}; use meilisearch_types::milli::score_details::{ScoreDetails, ScoringStrategy};
use meilisearch_types::milli::{dot_product_similarity, InternalError};
use meilisearch_types::settings::DEFAULT_PAGINATION_MAX_TOTAL_HITS; use meilisearch_types::settings::DEFAULT_PAGINATION_MAX_TOTAL_HITS;
use meilisearch_types::{milli, Document}; use meilisearch_types::{milli, Document};
use milli::tokenizer::TokenizerBuilder; use milli::tokenizer::TokenizerBuilder;
@ -301,6 +302,10 @@ pub fn perform_search(
let mut search = index.search(&rtxn); let mut search = index.search(&rtxn);
if query.vector.is_some() && query.q.is_some() {
warn!("Ignoring the query string `q` when used with the `vector` parameter.");
}
if let Some(ref vector) = query.vector { if let Some(ref vector) = query.vector {
search.vector(vector.clone()); search.vector(vector.clone());
} }