Efficiency of the Index APIs
martin-g opened this issue · 3 comments
Hello,
First, I want to congratulate you for v1.0! I just noticed it in the news.
I am a newbie in Meilisearch, so I might be wrong but looking at the sample code at https://docs.meilisearch.com/learn/getting_started/quick_start.html#add-documents:
let mut content = String::new();
file
.read_to_string(&mut content)
.unwrap();
let movies_docs: Vec<Movie> = serde_json::from_str(&content)
.unwrap();
// adding documents
client
.index("movies")
.add_documents(&movies_docs, None)
.await
.unwrap();
I see that initially we have a JSON String (the content
) that is parsed/deserialized to Vec<Movie>
and then this vector is passed to the client which sends it to the server again as a text, i.e. the vector is JSON serialized.
I have the feeling this might be inefficient.
Would it be better to send the plain text and let the server validate that it is proper JSON.
I guess one has to use an plain HTTP client to deal with raw text ?!
Thank you!
Hey, I was wondering the same thing!
I made a proposition here; meilisearch/integration-guides#238 (comment)
It would be nice if you could share your use case and explain your reasoning 😁
Hey, this has been implemented and is now available in the last release; check it out: https://docs.rs/meilisearch-sdk/latest/meilisearch_sdk/indexes/struct.Index.html#method.add_or_update_unchecked_payload
Closing the issue for now, but feel free to re-open it if it doesn’t fix your problem entirely
Awesome!