update semantic search to show no results if search query is blank (#2942)

Update semantic search to show no search results if search query is
blank
This commit is contained in:
Kyle Caverly 2023-09-07 14:58:00 -04:00 committed by GitHub
commit 560d6b1644
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -703,6 +703,10 @@ impl SemanticIndex {
let database = let database =
VectorDatabase::new(fs.clone(), db_path.clone(), cx.background()).await?; VectorDatabase::new(fs.clone(), db_path.clone(), cx.background()).await?;
if phrase.len() == 0 {
return Ok(Vec::new());
}
let phrase_embedding = embedding_provider let phrase_embedding = embedding_provider
.embed_batch(vec![phrase]) .embed_batch(vec![phrase])
.await? .await?