mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-06-19 10:58:01 +00:00
Merge pull request #5660 from meilisearch/reproduce-5650
Searchable fields aren't indexed when I add and remove them out of filterableAttributes
This commit is contained in:
commit
933e319364
@ -2086,3 +2086,76 @@ async fn test_exact_typos_terms() {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[actix_rt::test]
|
||||||
|
async fn simple_search_changing_unrelated_settings() {
|
||||||
|
let server = Server::new_shared();
|
||||||
|
let index = server.unique_index();
|
||||||
|
|
||||||
|
let documents = DOCUMENTS.clone();
|
||||||
|
let (task, _status_code) = index.add_documents(documents, None).await;
|
||||||
|
index.wait_task(task.uid()).await.succeeded();
|
||||||
|
|
||||||
|
index
|
||||||
|
.search(json!({"q": "Dragon"}), |response, code| {
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(json_string!(response["hits"]), @r###"
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "How to Train Your Dragon: The Hidden World",
|
||||||
|
"id": "166428",
|
||||||
|
"color": [
|
||||||
|
"green",
|
||||||
|
"red"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"###);
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let (task, _status_code) =
|
||||||
|
index.update_settings(json!({ "filterableAttributes": ["title"] })).await;
|
||||||
|
let r = index.wait_task(task.uid()).await.succeeded();
|
||||||
|
snapshot!(r["status"], @r###""succeeded""###);
|
||||||
|
|
||||||
|
index
|
||||||
|
.search(json!({"q": "Dragon"}), |response, code| {
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(json_string!(response["hits"]), @r###"
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "How to Train Your Dragon: The Hidden World",
|
||||||
|
"id": "166428",
|
||||||
|
"color": [
|
||||||
|
"green",
|
||||||
|
"red"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"###);
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
let (task, _status_code) = index.update_settings(json!({ "filterableAttributes": [] })).await;
|
||||||
|
let r = index.wait_task(task.uid()).await.succeeded();
|
||||||
|
snapshot!(r["status"], @r###""succeeded""###);
|
||||||
|
|
||||||
|
index
|
||||||
|
.search(json!({"q": "Dragon"}), |response, code| {
|
||||||
|
snapshot!(code, @"200 OK");
|
||||||
|
snapshot!(json_string!(response["hits"]), @r###"
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "How to Train Your Dragon: The Hidden World",
|
||||||
|
"id": "166428",
|
||||||
|
"color": [
|
||||||
|
"green",
|
||||||
|
"red"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
"###);
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
@ -29,7 +29,6 @@ pub fn extract_docid_word_positions<R: io::Read + io::Seek>(
|
|||||||
let max_positions_per_attributes = max_positions_per_attributes
|
let max_positions_per_attributes = max_positions_per_attributes
|
||||||
.map_or(MAX_POSITION_PER_ATTRIBUTE, |max| max.min(MAX_POSITION_PER_ATTRIBUTE));
|
.map_or(MAX_POSITION_PER_ATTRIBUTE, |max| max.min(MAX_POSITION_PER_ATTRIBUTE));
|
||||||
let max_memory = indexer.max_memory_by_thread();
|
let max_memory = indexer.max_memory_by_thread();
|
||||||
let force_reindexing = settings_diff.reindex_searchable();
|
|
||||||
|
|
||||||
// initialize destination values.
|
// initialize destination values.
|
||||||
let mut documents_ids = RoaringBitmap::new();
|
let mut documents_ids = RoaringBitmap::new();
|
||||||
@ -43,6 +42,12 @@ pub fn extract_docid_word_positions<R: io::Read + io::Seek>(
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let force_reindexing = settings_diff.reindex_searchable();
|
||||||
|
let skip_indexing = !force_reindexing && settings_diff.settings_update_only();
|
||||||
|
if skip_indexing {
|
||||||
|
return sorter_into_reader(docid_word_positions_sorter, indexer);
|
||||||
|
}
|
||||||
|
|
||||||
// initialize buffers.
|
// initialize buffers.
|
||||||
let mut del_buffers = Buffers::default();
|
let mut del_buffers = Buffers::default();
|
||||||
let mut add_buffers = Buffers::default();
|
let mut add_buffers = Buffers::default();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user