@@ -82,6 +82,8 @@ pub struct DocumentQuery<'a, Http: HttpClient> {
82
82
/// The fields that should appear in the documents. By default, all of the fields are present.
83
83
#[ serde( skip_serializing_if = "Option::is_none" ) ]
84
84
pub fields : Option < Vec < & ' a str > > ,
85
+ #[ serde( skip_serializing_if = "Option::is_none" , rename = "retrieveVectors" ) ]
86
+ pub retrieve_vectors : Option < bool > ,
85
87
}
86
88
87
89
impl < ' a , Http : HttpClient > DocumentQuery < ' a , Http > {
@@ -90,6 +92,7 @@ impl<'a, Http: HttpClient> DocumentQuery<'a, Http> {
90
92
DocumentQuery {
91
93
index,
92
94
fields : None ,
95
+ retrieve_vectors : None ,
93
96
}
94
97
}
95
98
@@ -117,6 +120,30 @@ impl<'a, Http: HttpClient> DocumentQuery<'a, Http> {
117
120
self
118
121
}
119
122
123
+ /// Return document vector data with search result.
124
+ ///
125
+ /// # Example
126
+ ///
127
+ /// ```
128
+ /// # use meilisearch_sdk::{client::*, indexes::*, documents::*};
129
+ /// #
130
+ /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
131
+ /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
132
+ /// #
133
+ /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
134
+ /// let index = client.index("document_query_with_fields");
135
+ /// let mut document_query = DocumentQuery::new(&index);
136
+ ///
137
+ /// document_query.with_retrieve_vectors(true);
138
+ /// ```
139
+ pub fn with_retrieve_vectors (
140
+ & mut self ,
141
+ retrieve_vectors : bool ,
142
+ ) -> & mut DocumentQuery < ' a , Http > {
143
+ self . retrieve_vectors = Some ( retrieve_vectors) ;
144
+ self
145
+ }
146
+
120
147
/// Execute the get document query.
121
148
///
122
149
/// # Example
@@ -143,7 +170,9 @@ impl<'a, Http: HttpClient> DocumentQuery<'a, Http> {
143
170
/// # let index = client.index("document_query_execute");
144
171
/// # index.add_or_replace(&[MyObject{id:"1".to_string(), kind:String::from("a kind")},MyObject{id:"2".to_string(), kind:String::from("some kind")}], None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
145
172
///
146
- /// let document = DocumentQuery::new(&index).with_fields(["id"])
173
+ /// let document = DocumentQuery::new(&index)
174
+ /// .with_fields(["id"]).
175
+ /// .with_retrieve_vectors(true)
147
176
/// .execute::<MyObjectReduced>("1")
148
177
/// .await
149
178
/// .unwrap();
0 commit comments