-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests: Faster search::multi IT tests #5603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: Faster search::multi IT tests #5603
Conversation
@irevoire This one is huge! Please take a look when you have few minutes and let me know if you have any concerns! |
Hey yeah, you're right, that's really hard to read 😩 In the beginning, you are using a lot of shared indices, and since these ones have a fixed name, I find the test pretty good to read. And if a test must update the settings or something, then we don't use the shared server? |
Use shared server + unique indices where possible Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
ac0b945
to
8fa6e86
Compare
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
It could be used when we want to see the index name in the assertions, e.g. `movies-[uuid]` Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Oh yes that's easy and smart, I love it 🔥 |
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…` counterparts Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
@irevoire I think this big boy is ready for review! |
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
One of the tests fails due to racing:
Both Update: It looks like the |
By using hardcoded there is a chance that the index could exist Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey!
I saw this chunk of code literally dozens of times I think:
let documents = DOCUMENTS.clone();
let (value, _) = movies_index.add_documents(documents, None).await;
movies_index.wait_task(value.uid()).await.succeeded();
let (value, _) = movies_index
.update_settings(json!({
"sortableAttributes": ["title"],
"filterableAttributes": ["title", "color"],
"rankingRules": [
"sort",
"words",
"typo",
"proximity",
"attribute",
"exactness"
]
}))
.await;
movies_index.wait_task(value.uid()).await.succeeded();
let batman_index = server.unique_index_with_prefix("batman");
let documents = SCORE_DOCUMENTS.clone();
let (value, _) = batman_index.add_documents(documents, None).await;
batman_index.wait_task(value.uid()).await.succeeded();
let (value, _) = batman_index
.update_settings(json!({
"sortableAttributes": ["title"],
"filterableAttributes": ["title"],
"rankingRules": [
"sort",
"words",
"typo",
"proximity",
"attribute",
"exactness"
]
}))
.await;
batman_index.wait_task(value.uid()).await.succeeded();
I think it would make sense to create two new shared index for these two datasets 🤔
Since playing with the ranking rules seems very specific to the multisearch and federation I think they could be local to this file though (at the top would be the best)
Otherwise it looks pretty good! I'll take a look at your issue right now
let index_1 = format!("index_1-{}", Uuid::new_v4()); | ||
let index_2 = format!("index_2-{}", Uuid::new_v4()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using the unique_with_prefix
as you suggested?
It seems "safer" to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I used server.unique_index_with_prefix("index_1")
but then I simplified it to plain strings because server.unique_index()
looks like it is creating the index. Using a plain string makes it more obvious that this is just a name.
I don't mind changing it back to server.unique_index_with_prefix()
if you think it would be better!
{"indexUid" : "test", "q": "glass"}, | ||
{"indexUid": "nested", "q": "pésti", "sort": ["doggos:desc"]}, | ||
{"indexUid" : index.uid, "q": "glass"}, | ||
{"indexUid": nested_index.uid, "q": "pésti", "sort": ["mother:desc"]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
let batman_index = server.unique_index_with_prefix("batman"); | ||
|
||
let documents = SCORE_DOCUMENTS.clone(); | ||
let (value, _) = index.add_documents(documents, None).await; | ||
index.wait_task(value.uid()).await.succeeded(); | ||
let (value, _) = batman_index.add_documents(documents, None).await; | ||
batman_index.wait_task(value.uid()).await.succeeded(); | ||
|
||
let (value, _) = index | ||
let (value, _) = batman_index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I see here we're using the default ranking rules and could use the shared index
https://www.meilisearch.com/docs/learn/relevancy/ranking_rules#list-of-built-in-ranking-rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
let (value, _) = movies_index.add_documents(documents, None).await; | ||
movies_index.wait_task(value.uid()).await.succeeded(); | ||
|
||
let (value, _) = index | ||
let (value, _) = movies_index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the order of the ranking rules is not the same as the default ones.
Here:
"rankingRules": [
"sort",
"words",
"typo",
"proximity",
"attribute",
"exactness"
]
Defaults:
[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness"
]
let documents = SCORE_DOCUMENTS.clone(); | ||
let (value, _) = index.add_documents(documents, None).await; | ||
index.wait_task(value.uid()).await.succeeded(); | ||
let (value, _) = batman_index.add_documents(documents, None).await; | ||
batman_index.wait_task(value.uid()).await.succeeded(); | ||
|
||
let (value, _) = index | ||
let (value, _) = batman_index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the order of the ranking rules is not the same as the default ones.
Here:
"rankingRules": [
"sort",
"words",
"typo",
"proximity",
"attribute",
"exactness"
]
Defaults:
[
"words",
"typo",
"proximity",
"attribute",
"sort",
"exactness"
]
Ah I see you found the bug while I was reviewing your PR. |
…s the default Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
I just tried to list all indexes in the shared server and confirm my assumption above with:
but it returns:
The shared server says "I have no indexes"! And this is expected since every IT test setups its own Actix-Web App! |
I was using |
AFAIS the queries are processed in the order from the request body JSON and there is no racing - meilisearch/crates/meilisearch/src/routes/multi_search.rs Lines 214 to 240 in aefebde
Mistery! |
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…anually with Uuid Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
…erver Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
@irevoire Here is the
Noice! :-) |
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Oof good catch! That's why I feels like even if we're not creating the indexes we should always just use the method that makes them unique ahah |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, you removed so many indexing process with this file 🎉
Pull Request
Related issue
#4840
What does this PR do?