Return the vector in the output of the search routes

This commit is contained in:
Kerollmops 2023-06-20 10:14:25 +02:00 committed by Clément Renault
parent 717d4fddd4
commit 1b2923f7c0
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -233,6 +233,8 @@ pub struct SearchHit {
pub struct SearchResult { pub struct SearchResult {
pub hits: Vec<SearchHit>, pub hits: Vec<SearchHit>,
pub query: String, pub query: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub vector: Option<Vec<f32>>,
pub processing_time_ms: u128, pub processing_time_ms: u128,
#[serde(flatten)] #[serde(flatten)]
pub hits_info: HitsInfo, pub hits_info: HitsInfo,
@ -515,7 +517,8 @@ pub fn perform_search(
let result = SearchResult { let result = SearchResult {
hits: documents, hits: documents,
hits_info, hits_info,
query: query.q.clone().unwrap_or_default(), query: query.q.unwrap_or_default(),
vector: query.vector,
processing_time_ms: before_search.elapsed().as_millis(), processing_time_ms: before_search.elapsed().as_millis(),
facet_distribution, facet_distribution,
facet_stats, facet_stats,