mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Index document in filterable attributes tests
**Reason:** Because the filterable attributes are patterns now, the fieldIdMap will only register the fields that exists in at least one document. if a field doesn't exist in any document, it will not be registered even if it has been specified in the filterable fields.
This commit is contained in:
parent
9a75dc6ab3
commit
6dbec91d2b
3 changed files with 35 additions and 14 deletions
|
@ -1,8 +1,10 @@
|
|||
use meili_snap::*;
|
||||
|
||||
use crate::common::{shared_does_not_exists_index, Server};
|
||||
use crate::common::{shared_does_not_exists_index, Server, DOCUMENTS, NESTED_DOCUMENTS};
|
||||
use crate::json;
|
||||
|
||||
use super::test_settings_documents_indexing_swapping_and_search;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn search_unexisting_index() {
|
||||
let index = shared_does_not_exists_index().await;
|
||||
|
@ -422,6 +424,8 @@ async fn search_invalid_threshold() {
|
|||
async fn search_non_filterable_facets() {
|
||||
let server = Server::new_shared();
|
||||
let index = server.unique_index();
|
||||
let (response, _code) = index.add_documents(json!([{"id": 1, "title": "Doggo"}]), None).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
let (response, _code) = index.update_settings(json!({"filterableAttributes": ["title"]})).await;
|
||||
// Wait for the settings update to complete
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
@ -453,6 +457,9 @@ async fn search_non_filterable_facets() {
|
|||
async fn search_non_filterable_facets_multiple_filterable() {
|
||||
let server = Server::new_shared();
|
||||
let index = server.unique_index();
|
||||
let (response, _code) =
|
||||
index.add_documents(json!([{"id": 1, "title": "Doggo", "genres": "Action"}]), None).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
let (response, _code) =
|
||||
index.update_settings(json!({"filterableAttributes": ["title", "genres"]})).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
@ -514,6 +521,9 @@ async fn search_non_filterable_facets_no_filterable() {
|
|||
async fn search_non_filterable_facets_multiple_facets() {
|
||||
let server = Server::new_shared();
|
||||
let index = server.unique_index();
|
||||
let (response, _code) =
|
||||
index.add_documents(json!([{"id": 1, "title": "Doggo", "genres": "Action"}]), None).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
let (response, _uid) =
|
||||
index.update_settings(json!({"filterableAttributes": ["title", "genres"]})).await;
|
||||
index.wait_task(response.uid()).await.succeeded();
|
||||
|
|
|
@ -3604,22 +3604,28 @@ async fn federation_non_faceted_for_an_index() {
|
|||
|
||||
let index = server.index("fruits");
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(
|
||||
json!({"searchableAttributes": ["name"], "filterableAttributes": ["BOOST", "id", "name"]}),
|
||||
)
|
||||
.await;
|
||||
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("fruits-no-name");
|
||||
|
||||
let documents = FRUITS_DOCUMENTS.clone();
|
||||
let (value, _) = index.add_documents(documents, None).await;
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let (value, _) = index
|
||||
.update_settings(
|
||||
json!({"searchableAttributes": ["name"], "filterableAttributes": ["BOOST", "id"]}),
|
||||
)
|
||||
.await;
|
||||
|
||||
index.wait_task(value.uid()).await.succeeded();
|
||||
|
||||
let index = server.index("fruits-no-facets");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue