mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Introduce Index::unique_index_with_prefix(&str)
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>
This commit is contained in:
parent
34d8a54c4b
commit
1824fbd1b5
3 changed files with 26 additions and 26 deletions
|
@ -347,6 +347,16 @@ impl<State> Server<State> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn unique_index_with_prefix(&self, prefix: &str) -> Index<'_> {
|
||||
let uuid = Uuid::new_v4();
|
||||
Index {
|
||||
uid: format!("{prefix}-{}", uuid.to_string()),
|
||||
service: &self.service,
|
||||
encoder: Encoder::Plain,
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unique_index_with_encoder(&self, encoder: Encoder) -> Index<'_> {
|
||||
let uuid = Uuid::new_v4();
|
||||
Index { uid: uuid.to_string(), service: &self.service, encoder, marker: PhantomData }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue